All posts by Mike Clements

Income Tax in WA State

Many people say that income tax in WA state violates the state constitution. This is incorrect, but that doesn’t mean that proponents of the income tax can rejoice. They are also wrong. To understand this issue, one must first understand two parts of the state constitution:

Definition of Property

The WA state constitution defines property in a general way. It says, “The word ‘property’ as used herein shall mean and include everything, whether tangible or intangible, subject to ownership.”

Clearly, people own their income so it is property as defined by the constitution. And for nearly 100 years, the state supreme court has ruled that this means what it says.

Limits on Property Taxes

The WA state constitution also requires that when property is taxed, the taxes must be uniform and no more than 1%.

Constitutionality of Income Tax

Income tax would be legal in WA state, under two conditions: the same uniform rate must apply to everyone and all income, and that rate cannot exceed 1%.

Of course, this is a poison pill for people who want higher taxes on “the rich”. Their proposed income tax violates both of these constitutional provisions. It is non-uniform, since it applies only to income above a certain threshold. And it is greater than 1%.

The Bigger Picture

The bigger picture is that in WA state, for several years government spending has been growing faster than the economy. In the long term, no amount of taxes can ever pay for that. Until the state gets spending under control – by “control” I mean government spending grows no faster than the economy – the state will go bankrupt no matter what tax policy they enact.

Not surprisingly, passing an income tax only encourages the legislators to spend even more – they’ve already identified additional spending for the revenue they expect from the income tax. And of course that estimated revenue is grossly inflated, which means they will spend more than the tax returns. So not only is the income tax unconstitutional as proposed, it will also make the state’s budget problems worse, not better.

In short, WA state has a spending problem, not a revenue problem. When the state cannot control its spending, giving it more money does not solve the problem, but only makes it worse.

The History

In the past, WA state acknowledged that the constitution must be amended in order to have a graduated income tax. And over the years, voters rejected these constitutional amendments several times: in 1934, 1936, 1938, 1942, 1970, and 1973.

Voters have also rejected multiple income tax ballot initiatives: in 1944, 1975, 1982 and 2010.

Now, the state wants to ignore and circumvent the constitution, prior supreme court decisions, and the will of the voters.

Ethics and Respecting the Law

Every legislator takes an oath of office stating they will uphold the state constitution (among other things). Thus proposing unconstitutional laws can be seen as violating their oath of office — they took an oath to uphold it, not to undermine it. If legislators believe that a graduated progressive income tax is good public policy, the ethical and legal way to pursue that is to first amend or change the state constitution. This is nothing more than what the WA state supreme court has said before.

Pentel Orenz Nero

These mechanical pencils automatically advance the lead and the nib slides and retracts as you write, to prevent the lead from breaking. This helps with thin leads like 0.3 mm, and it also has a 0.2 mm size. The automatic advance makes writing with these pencils a smooth flowing experience more like a pen, since you don’t have to pause to click the lead until you’ve consumed the entire stick.

TLDR: to form a car analogy, these pencils are like a vintage classic Triumph or MG. They’re fun to drive with unique road feel. Yet they are also less reliable and require more maintenance, so don’t drive one unless you’re handy with a wrench and enjoy working on your car as much as driving it.

Here’s how the auto-advance works. The clutch in a mechanical pencil is typically 2 or 3 arms arranged in a circle, trapped inside an outer circular ring. The lead goes through the center of the clutch. When you click the pencil, it pushes the clutch arms forward from the circular ring and they open, which advances the lead. When you release the click, a spring pulls the arms back together, grabbing the lead.

The Orenz Nero clutch is one-way. When closed (at rest), the clutch prevents the lead from sliding back into the pencil, but it doesn’t prevent the lead from pulling further out. The tip’s sliding nib is spring loaded to the fully extended position. When you write, as the lead wears down the nib slides down with it (against the spring force). When you lift the pencil, the spring-loaded nib jumps forward, pulling the lead forward with it due to friction in the nib barrel, and the fact that the 1-way clutch allows the lead to slip forward even when closed. This relies on the fact that the nib barrel has more friction against the lead, than the one-way clutch does.

The drawback of this design is its complexity and fragility. It depends on balancing the friction in the nib barrel, with its spring force, and the clutch spring tension and its arm friction. If any of these gets out of wack the pencil stops working.

The most common failure is that when you push down to write (even gently), the entire nib retracts into the pencil. In other words, the clutch slips. Either something (a tiny chunk of lead, too much graphite residue/dust) gets stuck in it preventing it from fully closing, or enough dust/residue has built up on the clutch teeth that even when closed, the lead can still slip both forward and back. Also, if you re-load a lead stick that has already been pulled through the pencil, it is more likely to slip – a small amount of lead rubbed off when it went through the pencil the first time, and the one-way clutch tolerances are so precise that even that tiny amount is enough to make it slip.

Either way, the solution is the same: disassemble the pencil and clean it. This is easy, especially if you’re familiar with mechanical pencils. Make sure to blast both nib and clutch with clean compressed air from both sides. Even if it’s not jammed, you need to clear out graphite dust/residue that will make it slip.

If you’re in the middle of writing and don’t have time to do this (which happens more often than one would like), there’s a workaround: click the pencil a few times to manually extend the lead a few mm beyond the tip, then break that lead off. This draws a fresh section of the lead stick into the clutch; it often happens that fresh section is not worn and is just a touch thicker so the clutch can grab it.

Some people say that harder lead (HB or B instead of 2B) reduces clutch slip and makes the pencil more reliable. My experience indicates this is not a complete fix but has some merit. My pencils (both 0.3 and 0.2) experience clutch slip almost as often with HB as with 2B lead – but not quite as often. Also, using high quality lead (such as AIN Stein or Uni NanoDia) does help and is a must, as it reduces the amount of dust/residue that builds up in the pencil.

A less common failure symptom is lead in the pencil not feeding into tip. I’ve seen leads stick to the inside walls of the internal plastic feed tube instead of falling into the load port. Even if the feed tube is perfectly clean, this can happen due to static electricity. The solution is to ground and demagnetize the pencil. I’ve had this happen only with the 0.2 mm pencil, because those leads are so thin and light. Thicker leads seem to have enough mass to overcome static cling.

Mike’s take: The Orenz Nero is more of a mechanical curiosity than a real pencil. Normal daily use becomes frustrating because they are so fragile and unreliable. And they are finicky about lead type and brand, which limits one’s choices. They also waste your valuable lead due to the frequent failures, disassembly and cleaning.

A better choice is the Pentel Orenz (not the Nero). It does not automatically advance the lead, and consequently its clutch grabs the lead firmly – no slipping. And it has a sliding nib, which has 3 benefits. First, it fully retracts which protects the fragile nib when not in use. Second, it protects the lead as you write, so even thin leads don’t break. Third, it reduces how often you need to click to advance it – each click gives you about 4mm of lead.

Another good alternative is the Kuru Toga Advance (or Advance Upgrade). It’s similar to the Orenz in function and price, with one advantage and one disadvantage. The advantage is that it rotates the lead as you write, keeping it sharp. This makes it comparable to a pencil having one grade thinner lead – 0.5 writes like 0.3, 0.3 writes like 0.2. The disadvantage is that the articulated nib – it rotates as well as slides – requires a slightly greater amount of clearance, which means the tip has some “wiggle”. This makes it less precise. The difference is small yet perceptible.

Between these two (Orenz vs. Advance) I prefer the Orenz. It has slightly higher build quality, using metal in places where the Advance uses plastic. This also makes it easier to disassemble for cleaning – though both are so reliable you won’t need to do this. The Orenz also has slightly better precision, since the nib has less wiggle. And it has a 0.2 mm size, which gives the ultra-sharp line that the 0.3 Advance has due to its rotation.

Bicycle Chain Wax

Today I cooked up my first batch of chain wax. Ingredients:

  • 60% paraffin oil
  • 25% paraffin wax
  • 10% mineral spirits (paint thinner, xylene, toluene, etc.)
  • 5% friction modifier (PTFE powder)

Note: use gloves and wash your hands thoroughly after making this. PTFE is toxic, though it is an optional ingredient. It is an extreme pressure barrier lube, improving (reducing) wear. Commercially made waxes do have PTFE or a similar friction modifier, though the chain lube works well enough without it.

This recipe is similar to fancy expensive brands like Silca. The procedure is simple, similar to de-crystallizing honey:

  • Fill a large pot half full of water and get it simmering (just below boiling) on a stove
  • Put the ingredients into a glass jar and put the jar into the hot water
  • Stir it occasionally as it heats for about 15 minutes

The hot water stabilizes the temperature and ensures it won’t get too hot. Ideally it’s around 180* F.

The ratio of paraffin oil to wax determines the viscosity and is adjustable. This batch, when sitting at room temperature, becomes semi-solid. After vigorous shaking it becomes fluid with a viscosity similar to 20W motor oil, which seems about right for dripping onto a chain. Thus it does require shaking well before use – like all liquid chain waxes do.

Mineral spirits are a solvent that helps keep it mixed, and they help it penetrate into the chain when applied. The wax tends to cling to the surfaces of the container, which seems as designed – similar to what it will do to the chain surfaces when applied. I couldn’t avoid getting some on my hands and it is very slippery – so much that the lid of the jar doesn’t want to stay screwed on!

What is D&D (Dungeons and Dragons)

D&D resembles the imaginative pretend play we did as children: Cowboys & Indians, Cops & Robbers, etc. Yet while that kind of play often became undirected and arbitrary, the D&D rules provide consistency that centers the play within a semi-realistic fantasy world. The rules are not guardrails that keep you on a road that directs your travel. The D&D rules don’t direct play, but merely define a consistent world, within which is a wide range of imagination and adventure.

D&D play consists of campaigns. A campaign is a series of adventures that unfolds as the game is played. Yet adventures where? About what? Key to the game is a participant called the Dungeon Master (DM for short) who prepares the campaign, the world in which it happens, and brings to life the characters in that world.

The interactive story is the heart of the game. A D&D module is a chapter in the campaign, the outline of a open-ended story that could unfold in many different ways, depending on what the players do. Each module is prepared by the DM in advance, including locations, plots, characters, monsters, magic, treasure, etc. The DM has a good idea of all the various things that could happen and how it might end, yet the players determine this through their actions.

D&D does have complex rules, including several books and a variety of dice. Each player’s character may have pages of detailed information. Many things that happen are determined by dice rolls in cross-referenced lookup tables. How does all this not suffocate imagination, adventure and fun? The game avoids that by placing this burden almost entirely on the DM. The players take on the persona of their characters and role play according to their imagination and common sense. Dice rolls are based on probabilities that are not completely random, but reflect the characters and situations in the game. The DM applies the rules to translate player actions into the game and determine the effects.

In explaining what D&D is, it’s also useful to describe what it’s not. D&D is not a reality or combat simulation. Given its topic of magical fantasy adventure, a realistic simulation would be absurd. D&D is a game to stretch the imagination while creating an interactive story of adventure. The DM’s role is to incorporate a degree of realism, just sufficient to ground the game with enough plausibility to allow the suspension of disbelief.

Stratux

Summary

Stratux is an ADS-B “In” device for pilots. I built one back in 2016 and still use it today. It’s served me reliably for more than 1000 hours of flying all over the western USA, Canada and Alaska.

Stratux features

  • FIS-B: Flight Information Services Bundle, which includes
    • ADS-B “In”: live traffic – other airplanes flying nearby
    • Weather: near-real-time
      • METAR and TAF
      • NEXRAD radar
      • AIRMETs and SIGMETs
      • PIREPs
    • TFRs: temporary flight restrictions
  • GPS: a built-in GPS that is faster and more accurate than the built-in GPS in most phones and tablets

How Stratux works

Stratux is open source software that runs on a Raspberry Pi computer. The Pi has some dongles plugged into its USB ports to handle the radios (ADS-B, GPS), and a couple of small antennas to pick up the radio signals. Parts include:

  • Raspberry Pi 3B (or later) with SD card
  • ADS-B 978 dongle
  • ADS-B 1090 dongle
  • GPS dongle
  • Barometric sensor dongle
  • Antennas for the dongles.

Mandatory minimum parts are in bold face.

The Stratux picks up data in real-time over the antenna, processes and converts the data, and transmits it on a local Wi-Fi broadcast from the Raspberry Pi.

How to Build a Stratux

Building a Stratux is simple:

  • Buy the parts
  • Plug them into each other
  • Download the software
  • Copy it to the SD Card
  • Plug the SD Card into the Raspberry Pi

How to Use a Stratux

Before using a Stratux you need to make 2 decisions about where it will fit in your airplane:

  1. How to get its antennas to see the sky
  2. How to feed it power (a USB cable)

The most common way is to put the Stratux on top of the aircraft panel, where small antennas plugged into it can see the sky. Stratux is small and light enough you can do this with velcro tape.

The next most common way is to put the Stratux behind the panel (where you can’t see it). Then you need to find another place to put the antennas with wires connecting them to the Stratux.

When the Stratux is in your airplane and turned on, it broadcasts a local WiFi signal. Connect to its WiFi on your phone or tablet. Virtually all EFB software can show the data, so whatever you already use on Apple or Android (Foreflight, Droid EFB, Garmin Pilot, etc.) will work.

How Much Does a Stratux Cost?

If you buy one pre-built ready to plug in and use, they start around $400, like this one.

If you build it yourself, the price starts around $115 and goes up from there depending on how much functionality you want.

Bill of Materials

  • Raspberry Pi 3B+: $53
  • UAT Radio: $40
  • Micro SD Card: $20
  • GPS dongle: $20
  • 1090ES & UAT Radios (pair): $75
  • AHRS sensors: $40
  • Fan & heat sink: $6

From the above, you can build a Stratux as cheap as about $115. Add another $20 if you want GPS. Add $35 ($75 – $40) if you want ADS-B on both UAT and 1090. Add another $40 if you want an AHRS sensor.

The software automatically detects and uses whatever is plugged in, so setup is simple to non-existent.

References

Stratux home: https://stratux.me

Maneuvering Speed: Va

Summary

Maneuvering speed (Va) is the airspeed at which sudden full deflection of flight controls will not break the airplane (e.g. rip the wings off). At and below Va, the airplane will stall before it breaks.

Generally, Va does not impose a speed limit on the airplane because normal flight (standard maneuvers and light turbulence) does not create strong enough forces to threaten the aircraft’s structural integrity. Va becomes important during moderate turbulence, unusual maneuvers, or any time the airplane will be subjected to sudden powerful accelerations.

This is an important concept for pilots. Yet like many things with aviation, it’s important to fully understand it, not just to memorize it.

The simple memorization is that the Va published in the aircraft’s pilot operating handbook (POH) is at max gross weight (GW), and gets slower as the airplane is lighter. Normally, most airplanes are operated well below max gross weight, so the Va pilots should use is slower than what is published. However, this is over-simplified. All else equal, Va  does get slower as the airplane gets lighter – but all else is not always equal. A full understanding of Va reveals why.

Where Does Va Come From?

The idea behind Va is that the faster an airplane goes, the more force the wing would sustain in a sudden deflection or gust of turbulence. Why? Because lift depends on both airspeed and Angle of Attack (AoA). The faster an airplane flies, the less AoA you need to generate the same lift. And vice versa. So as the airplane speeds up, it has to be nosed down (reduce AoA) to prevent climbing.

A wing always stalls at the same maximum AoA, regardless of airspeed or orientation. Thus, the less AoA necessary for level flight, the more AoA can be increased before a stall occurs. The G factor or acceleration of the airplane is proportional to the change in AoA. Thus a lower AoA in level flight means there is more “headroom” for AoA to increase before reaching the max AoA. Thus, a bigger G load can be exerted on the airplane before the wing stalls.

Forces Versus Gs

Yet breaking something requires force. A G is not a force, but a ratio of forces. A G becomes a force only when multiplied by the mass being accelerated. The strength of a wing is measured in pounds, not in G. Imagine that the strength of a wing is the amount of weight that can be suspended from the wing before it breaks. A light airplane exerts less force on the wings than a heavier airplane, when pulling the same G load.

For example, consider the airplane at two different weights: max gross (say, 2500 lbs.) and half of that (1250 lbs). Pulling 4 Gs at 2500 lbs. exerts a force of 4 * 2500 = 10,000 lbs. on the wing. That is the same as pulling 8 Gs at 1250 lbs. When the airplane is lighter, it can withstand a higher G load because it exerts the same total force.

But that’s not entirely true… there’s more to the story.

Va and Airspeed

Suppose the operational service strength of the wing is 10,000 lbs. and Va is 100 knots. This is the speed at which, when the elevator is suddenly fully deflected from level flight, the wing stalls just before generating 10,000 lbs. of lift force. Normally, Va is equal to the clean stall speed of the aircraft (Vs), multiplied by the square root of the designed maximum G load. Suppose for our example airplane, Vs is 50 kts and the max G load is 4, so Va will be 50 * sqrt(4) = 100 kts.

What happens when the airplane is lighter than its GW of 2500 lbs? There are two factors to consider:

  1. When the airplane is lighter, the same G load makes less total force on the wings. Since the wing’s strength is based on force, not on G load, the wings can sustain whatever higher G load produces that same force.
  2. When the airplane is lighter, the wing needs to generate less lift in level flight, which means less AoA at the same airspeed, which means there is more AoA “headroom”, which means sudden max deflection of the controls will pull more Gs.

These two effects are opposite and cancel each other. In short, the airplane can pull more Gs from level flight, but that higher G load represents the same force on the wings. Thus, it would appear that Va should be unaffected by airspeed.

An Airplane is More than a Set of Wings

But what about the rest of the airplane? What about the engine mounts, the battery, the seats, etc.? Suppose our 2,500 lb. GW airplane’s engine weighs 250 lbs. At the designed load of 4 G, the engine mounts are withstanding 1,000 lbs. of force. Now if the airplane is flying at 1,250 lbs. (half its GW), at airspeed Va, and the pilot suddenly fully deflects the elevator, we just subjected it to twice the Gs. The airplane overall has half the weight, so twice the Gs exerts the same total force on the wing, no problem. But the engine weighs the same no matter what the airplane weighs. Subjecting the airplane to twice the G load exerts twice the force on the engine mounts. We just subjected the engine mounts to 2,000 lbs. of force, twice their design limit.

When the airplane is lighter, it can pull more Gs, which puts more stress on components like the engine mounts, since the engine always weighs the same.

Thus, Va may be slower when the airplane is lighter. When the airplane is lighter, it can pull more Gs. This won’t break the wing, because higher Gs at lighter weight is the same total force on the wing. But it can break the engine mounts, battery box, etc. because – and this is a very important key point – even though the overall airplane is lighter, these individual parts always weigh the same and are being subjected to more Gs.

How Weight Affects Va

As the airplane gets lighter, Va may get slower, but won’t necessarily get slower.  It depends on the weak point of the airplane. Are the airplane’s fixed weight components (engine mounts, battery box, seats, etc.) strong enough to withstand the higher forces?

If all of the airplane’s individual components have the same G load limit, then Va will get slower as the airplane gets lighter, because higher G loads exert stronger forces on components that weigh the same regardless of the airplane’s overall weight.

HOWEVER… if the airplane’s fixed weight components can withstand stronger forces, then Va might be just as fast at slower speeds as it is at GW.

In most cases you won’t know. Airplane manufacturers certify the airplane at gross weight. They may not test other configurations that aren’t required for certification. Absent this testing, you must assume that Va gets slower when the airplane is lighter, to avoid exerting forces beyond the certified limits.

Put differently: when lighter than max GW flying at the published Va airspeed, you can pull more Gs before the airplane stalls. That higher G load represents the same total force on the wings (because the airplane is lighter), so the wings are safe. But that higher G load exerts a greater force on individual fixed weight components, so they could break.

Normal versus Utility Category

Airplanes certified for utility category can withstand at least 4.4 G. Some airplanes (like the Cessna 172) are certified for normal category (3.8 G), but when total weight is below a certain limit and center of gravity is forward of a certain point, they are certified for utility category.

The aforementioned fixed mass components of the airplane (engine, battery, seats, etc.) don’t know or care about the airplane’s loading or center of gravity. They always weigh the same and feel the same forces at the same G load. For example if the airplane is certified for utility category and the engine weighs 250 lbs., then the engine mounts can withstand at least 250 * 4.4 = 1,100 lbs. of force.

To clarify, in normal category the Cessna 172 is rated to withstand 3.8 G. But since it also certified for utility category, it can withstand 4.4 G when its overall weight is under 2100 lbs. Yet individual parts like the engine, battery, seats, etc. always weigh the same and don’t structurally change. These individual components can always take 4.4 G.

Because of this, the airplane’s Va might not get slower when it’s lighter than GW, because the fixed mass components can handle more than 3.8 G. But they do have a limit of 4.4 G, and how does a pilot know when the airplane has gotten light enough to pull a G load greater than 4.4 without stalling?

Quantifying it Further

Let’s do some math and physics. Stall speed varies with the square root of the weight ratio. Suppose the airplane’s published stall speed in the clean configuration (Vs) is 50 kts at 2500 lbs., and Va is 100 kts.

If the airplane is loaded to 2,025 lbs., that’s 81% of its GW. The square root of 0.81 is 0.9, so the stall speed is 90% of 50 kts = 45 kts.

Using the formula stated earlier we can compute Va at this lighter weight. Suppose the G rating is 4.0. Then 45 knots times the square root of 4 equals 90 knots.

We see that Va (and stall speed) both depend on the square root of the ratio of the airplane’s weight, and both get slower when the airplane is lighter.

Now let’s take exact numbers for a Cessna 172 and see what happens:

The POH gives Vs = 51 knots at gross weight 2550 lbs. and Va = 99 knots, in normal category (max G load 3.8). This is near exact to what the formula predicts: 51 * sqrt(3.8) = 99.42.

The same airplane is rated utility category at 2100 lbs. Let’s compute what Va should be.

At 2100 lbs. the stall speed is now sqrt(2100/2550) * 51 = 46.3 knots.

  • If the airplane was not certified for utility category, Va would be 46.3 * sqrt(3.8) = 90 knots.
  • But it is certified for utility category, so the max G load is 4.4, so Va is 46.3 * sqrt(4.4) = 97 knots.

We can see that being certified for utility category makes a big difference keeping Va almost constant as the airplane gets lighter. When gross weight drops by 18% (2550 to 2100), Va would normally drop by 9% to 90 knots. But because this airplane is certified for higher G loads at lighter weights (utility class), Va drops by only 2% to 97 knots.

D&D Character App

Introduction

Like many nerds my age, I played D&D back in the early 80s. I started with the Basic and Expert rules, playing with my brother and sister. Somebody had to be the Dungeon Master (DM) and that ended up being me because I liked systems of logical rules, enjoyed imaginative thinking, and was fascinated by this unusual game.

A year or two later we were still playing. I had gotten more into the game which meant moving up to the “Advanced” rules called AD&D, which became the original canon as the popularity of other rules faded away. I saved up my allowance and bought the “holy trinity” of rulebooks: the Players Handbook, Dungeon Masters Guide, and Monster Manual, which were published in the late 1970s. And I invited some friends to play. In 7th through 9th grade the school librarian let us use the private conference room during lunch, which we did at least a couple times per week.

This was before computers were in common use. My family had a TRS-80 which I used and learned to program, but most families did not have a computer and kids still wrote homework and essays by hand. We played D&D old-school with paper and pencil. One of the challenges was keeping track of characters with all their attributes, equipment, etc. which was constantly changing as they adventured. I always wanted to write software to track characters, but the complexity of the data and relationships made this difficult. Rainbow magazine published a variety of programs every month (given as code listings to be typed in!), which once included a D&D character app, but it was over-simplified and unable to handle all the aspects of a character.

Later when I learned relational databases I thought they would be ideal for storing D&D characters. Yet even then, the relationships would be difficult to model. It’s not only 1:M and M:M, but also hierarchical, and relationships that are conditional based on several other attributes, with plenty of exceptions.

In the 1990s I wrote an app in C++ that ran in OS/2 using Borland OWL. It was an exercise in learning OO programming and using several Design Patterns. But I only got this app about 90% complete, since my D&D gaming was already tapering off.

Fast forward a couple of decades to late 2008 and D&D play had faded from my life. It is time consuming (especially for DMs, which was always my role) and after college it got replaced by so many other things that were happening in life, and also with my friends – jobs, marriages, kids, travel, etc. Meanwhile, Java 1.5 had been released which included Generics, a major improvement to its data modeling, followed by 1.6 which had major performance improvements. In order to bone up on this new tech, I decided to finally write the D&D character app that I always wanted. And to use these capabilities to make it fully capture all aspects. I still had over 100 characters (as paper character sheets) from old campaigns and the test would be whether I could fully store them in the app, with all their details and quirks.

Precis: the App

The app is in my public GitHub, open source under the very permissive MIT license. Anyone can download, build and run it using any version of Java 1.6 or later, on any computer (Linux, Mac or Windows). The app GUI is Java Swing. This gives it a vintage 1990s look but makes it functional and easy to program. I found Swing to be well designed and better than other GUI systems I learned in the past, including Microsoft Windows programming (with all those WM_ messages), MFC and Borland OWL.

The app not only stores characters that you create, but also generates characters. Auto-generation creates the character essentials and leaves it to you to fill in details. These essentials are a moving target as I occasionally enhance the program, but include:

  • Ability scores (generated by rolling 4d6 for each and taking the 3 highest)
  • Auto-generating all ability score adjustments.
  • Choosing the best class based on ability scores.
  • Choosing race consistent with class.
  • Choosing alignment consistent with class.
  • Auto-generating all class & race abilities & languages.
  • Randomly assigning gender, name, height, weight, etc.
  • Auto-generating starting wealth based on class.
  • Equipping the character randomly yet based on class, including armor & weapons.

The app also prints characters using a simple 2-column format. It uses the Java print service which abstracts the printer and works on any printer, on any operating system.

Much of what the app does is based on data config text files. This includes ability score adjustments, saving throws by class and level, default equipment lists (for auto-generated characters), and spell usage by class and level. Thus, some of the app behavior can be changed simply by editing these text files.

App Usage Details

The app is self-explanatory, a simple UI of tabbed panels. Yet it has some capabilities that require explanation.

The GUI layout is dynamic. As you resize the app, GUI elements may shrink, grow or move. If you find layout errors (such as text fields that are truncated), this is usually a limitation of Java Swing dynamic layout and resizing the app fixes them (grab a window corner and drag it).

All entry fields accept strings. While any text is accepted, some fields (such as ability scores and hit points) expect integers. If they are not integers, the app will still function but it won’t be able to automatically set adjustments.

Command Line Parameters

A typical app invocation looks like this:

java -jar DnD.jar

This assumes that an appropriate version of Java is in the path and you are in the app’s bin directory which contains its config files.

All of the parameters below can be combined.

Font Size

Java Swing was originally designed 20 years ago when a 1600×1200 monitor was considered high resolution. Consequently, the font size and overall GUI may be too small for modern monitors. To accommodate this, the app has a command-line parameter to adjust the font size, which also adjusts the rest of the GUI.

For example, to adjust the font 2 points larger than normal:

java -jar DnD.jar -font +2
File to Open

If you want the app to open a character file when it starts, use the -file parameter:

java -jar DnD.jar -file CHARACTERFILE

Disk Format

The app stores characters on disk using a compact binary format. A typical 1-5 level character takes about 2 kB of storage – more for higher level and multi-classed characters, but there is no arbitrary limit to the size. The first data it writes is a storage version number, for future compatibility. If I ever change the data format, this will enable future versions of the app to recognize and load characters stored in older formats.

The app remembers the last directory used to save or load a character. This is convenient, since when loading a file you only have to navigate through directories once. This also applies when you load a character on app startup.

Apply / Revert

The app uses a Model-View design. The Apply and Revert buttons transfer data between the model and view. For example, if you change the character’s name, it doesn’t apply until you click the Apply button. If you click the Revert button, it restores the UI to the state of the model, which reverses all changes you made since you last clicked Apply.

Apply and Revert buttons have different scopes. On each panel they pertain only to that panel. To do this globally, use the app menu: Edit|Apply All, Edit|Revert All.

Lists are an exception to this behavior. Changes made to lists take effect immediately.

Red Buttons

Red buttons indicate actions that might change or override user-entered data. They are used to automatically set adjustments for ability scores and classes.

For example, suppose a character earns 750 XP on a campaign. Enter 750 into the XPoints field and click the red Add XP Points button. The app will add any XP bonuses (for example, 10% bonus makes it 825), add the XP to the character’s total, and if it bumps him up a level, the app will change the level and apply relevant adjustments (new hit points, saving throws, spells, powers, etc.).

Equipment

Character equipment is modeled using a Composite design pattern. It is a tree that can be nested to any depth, indicating which items are contained within other items. Moving, copying or deleting any item affects all other items it contains.

The GUI is a drag and drop panel. Any item can be dragged and dropped anywhere else. This can also be used to reorder items at any level. The item and everything it contains comes with it. If you hold down the CTRL key while dragging, it makes a copy instead of moving it.

Class Info

The app has a panel for each of the 5 basic classes: Fighter, Cleric, Magic User, Thief, Monk. Each panel has a checkbox indicating whether it applies to the character. If it is not checked, the tab for the panel is greyed out (yet not disabled, so you can still click it). If a character already has a certain class, toggling the checkbox to disable does not delete it, but only flags it. If you disable it by mistake, simply check it again to enable it and no data will be lost – so long as you didn’t save the character or make other changes while it was disabled.

Class data starts as a zero-level placeholder. It does not become real until you set the level to some value 1 or more. Data for placeholder classes is not saved or printed, so if you enable a class for a character but you don’t set the level, that class data will not be saved or printed.

Each class has a name, which by default is the name of the Java class used to model it. You can (optionally) set this name to anything you want. If the name you use happens to be a subclass of that class, this subclass will be used in the data model. Subclass names include:

  • Ranger (subclass of Fighter)
  • Paladin (subclass of Fighter)
  • Druid (subclass of Cleric)
  • Illusionist (and MagicUser are both subclasses of MUBase)
  • Assassin (not yet implemented)

With these subclasses, the model handles a total of 9 character classes – and various combinations. Multiple class tabs can be enabled and each operates independently. For example, Fighter-MagicUser or Thief-Illusionist. However, each character can have only one of each base class, so Fighter-Ranger or Cleric-Druid is not possible (nor would it make sense).

When you give your own user-defined name for a class, your name does not have to match any of these. In this case the base class is used. For example, you could name a Cleric as “Shaman” and it would be modeled as a Cleric.

When first adding a class to a character:

  • Click on the class tab
  • Click the Enabled checkbox
  • Enter a name (optional – if you want a subclass or custom name)
  • Click the Reset/Init button (needed only if you are using a custom name)
  • Enter a level of 1 or more
    • Unless you are creating a multi-class character, in which case see below
  • Click the Level button

When you take that last step, if the level you entered is different from what was there before, it will change data on this tab, as well as on other tabs. For example, it will assign hit points and saving throws which you will see on the Combat tab. These changes apply directly to the model and cannot be reverted (which is why the buttons labels are red).

Multi-Class Characters

Multi-class characters are supported, including auto-generation of hit points and save throws. To create a multi-class character:

  • For each class tab:
    • Click on the tab
    • Click the Enabled checkbox
    • Optional: enter a custom name and click the Reset/Init button
  • After all classes have been enabled, apply all (menu Edit|Apply All)
  • Visit each class tab
    • Enter a level of 1 or more
    • Click the Level button

Hit points for multi-class characters are computed as follows: for each class, for each level, determine the hit points, add any constitution bonuses, then divide by the total number of classes. Round this number to the nearest integer (it may go up or down, depending on the fraction).

Each save throw for a multi-class character is the best (lowest) across all classes (per level of each individual class) for that category.

Class Abilities

Every class has certain abilities, which are stored in this list in the upper left of the panel. Some may be auto-generated by the app, others may be user-defined. The prefix “AG: ” (for auto-generated) is used to differentiate them. Any item that has this prefix is auto-generated. The app may remove or change it. Yet when the app manipulates this list, it ignores all items not having this prefix. This way, the app preserves any user-defined items in the list.

Spell Use

The app tracks how many spells can be cast daily by class and level. For Clerics and Druids, it also applies Wisdom bonuses. The casting of spells is different from the availability of spells. Clerics may pray or meditate for more spells than they can cast each day. Magic Users and Illusionists may know spells that aren’t in their spellbook, and memorize each day more spells than they can cast.

The casting of spells is stored in the upper Class Abilities list and the app automatically sets it.

The availability of spells is stored in the lower Spells list left for users to define.

The app configures spell use based on the class name and reverts to the default. For example, suppose the character has Cleric enabled yet named “Shaman”. The app doesn’t have a spell use config for that name, but the class is of type Cleric, so it will default to Cleric spell usage. The user can override default spell usage in the app (don’t use the AG: prefix), or he can create a data file called spells.Shaman.dat to define how he wants Shaman spells to be allocated by level. If this file exists, the app will use it to allocate spell usage for Shamans.

Paladins and Rangers gain spells only at higher levels (8th and above). Because Rangers gain two kinds of spells, Druid and MagicUser, they have 2 config files: spells.Ranger.Druid.dat and spells.Ranger.MagicUser.dat.

Printing

To print a character, use File|Print from the menu. A print dialog will appear, showing all available printers (both local and network). The printed character sheet is organized into sections and uses 2 columns. It defaults to 8.5″ x 11″ paper with 0.25″ margins, though users can change this in the print dialog.

Notes and Limitations

Assassins are not handled. They have been rare in my games (at least as player characters) so I deferred them to last and haven’t gotten around to it.

Paladins can turn the undead upon reaching 3rd level, and cast Cleric spells at 9th level. The app will show these GUI elements for characters of the appropriate level.

Rangers gain both Cleric and Magic User spells at 8th and 9th level respectively. Their spell usage will appear automatically under Ranger special abilities. When this happens, the corresponding spell lists will also appear in the GUI.

Druids cannot turn the undead, but have abilities that are otherwise the same as clerics. When the class Druid is used, the app will remove the portion of the GUI that shows turning undead.

The app GUI is dynamic, adding or removing elements as needed for the given character. This relies on Java Swing’s built-in dynamic layout. If the GUI elements don’t look right – such as squished text entry boxes – resizing the app window triggers the dynamic layout and usually fixes the problem.

English can be Funny

Semantics of the Comma

In many cases commas are optional with rules like the Oxford comma that attempt to bring consistency to the ambiguity. Yet there are cases where commas change the meaning of the sentence. For example, consider removing the comma from the following sentence:

“Let’s eat, Grandma!”

Conjunctions and Adjectives

The word “only” can function as a conjunction or as an adjective. Here’s a game you can play: place the word “only” anywhere in this sentence and see how it changes the meaning:

She told the Paladin that she kills Goblins.

Fixing the Oven

The oven in our house is a Jenn-Air model JJW 3830 about 5 years old with a touch screen interface. It recent showed an error: “F2E0 Keypad disconnected. Error enumeration 0x9.” The oven stopped working and said it needed service. It seems that modern appliances have so much delicate electronics they have become less reliable and serviceable.

I looked it up and this thing costs $7,200 ?!?! WTH !?! I couldn’t believe my eyes !?!? For that price, there is no way I’m replacing this thing before I at least try to fix it.

Before diving into the repair I did a little research. A web search on this revealed that the error message indicates a failing panel control and heat damage is common. They last 3-5 years until this problem happens. You can get a replacement board for about $800 (parts only – even more if you want Jenn Air to fix it for you) but after a while it will fail again due to heat damage.

Disassembly

After throwing the oven’s dual-pole 40 amp breaker I pulled it out from the wall with the goal of disconnecting and removing the top horizontal display controller. It turns out this was easy to do. A total of 6 screws on the unit, then unplugging 3 wires, and it was sitting on my counter. I’ll call this the “control box”. That wasn’t bad at all, a pleasant surprise, +1 for serviceability.

The safety shutoff thermistor measured 0 ohms, so it wasn’t blown. The root cause lay elsewhere.

When removing the control box, I noticed a vent for hot/moist oven air that exhausts out the front, left side, above the oven door and below the control box. The control box had been installed incorrectly with the vent inside its bottom edge. Instead of venting out below the control box, it vented directly into the control box! All that hot moist air was venting directly onto the circuit board. Ouch!

I don’t know whether this error was from the factory or from the installer – depends on how the oven is shipped and what assembly is done on site. Either way, it’s a serious mistake and an obvious root cause to the problem.

Cleaning

The circuit board was slightly heat discolored brown right where the exhaust vent hit it. Obvious heat damage, and no visible corrosion but all that moisture didn’t help it. But not melted or blown, and maybe fixable. I unplugged all the connectors on the board, sprayed them with electric contact cleaner, wiped them dry, plugged and unplugged them a few times to scrape off any light corrosion, made sure everything was clean.

Hopefully, this unplugging and cleaning would clear any corrosion that the vent caused and trigger the oven’s logic to reset itself and start working again.

Robustifying

Routing the exhaust vent properly should fix the problem. Yet despite its ridiculous price, where one might expect “price is no object” design, this oven does not have sufficient heat shielding inside between hot vents and its circuit boards. Since the control box board was already compromised, I wanted to ensure it was better protected from further heat damage.

Even when properly routed, the host moist air of the exhaust vents just below the control box. That’s better than venting directly into it, but even so, it will still get the control box toasty warm when the oven is on. Not the best design.

I bought a sheet of heat shielding that consists of a thick yet flexible aluminum reflecting surface with about 1/4″ thick fiberglass insulation glued to one side. It’s made to wrap car exhausts and protect nearby surfaces from the heat. I cut it to shape with tin snips (the kind made to cut aluminum roof gutters). I installed this shielding in two places:

  • Inside the oven, laying flat just above the exhaust vent to protect the circuit board directly above it. This sheet was about 10″ x 9″.
  • Inside the control box, along its inside bottom edge below the circuit board to protect it from the hot vent below. This sheet was about 2″ x 8″.

Note: remember to use PPE like a mask and gloves when cutting & handling fiberglass.

Conclusion

After reassembling, the oven started up and works fine. No more error messages, both top & bottom ovens work. Only time will tell whether this is a permanent fix, but I’ve at least addressed a known design deficiency and postponed a crazy expensive and premature replacement.

Room Response: Nulls and Distortion

When measuring equipment it’s important to understand some relationships between frequency response and distortion. This helps interpret results correctly and not go chasing ghosts.

Here is the distortion from my Magnepan 3.6/R speakers measured from the listener position using REW, and a Tascam DR40 recorder:

Overall it’s excellent for an in-room loudspeaker measurement. Distortion is below -40 dB (1%) above 60 Hz, drops to -50 dB (0.3%) by 200 Hz, and ranges from -50 to -60 dB (0.3 – 0.1%) in the mids & treble where our hearing is most sensitive to it. This is less distortion than most quality headphones. And it’s actually even lower than this because it includes the room’s ambient noise and distortion from the Tascam DR40 built-in mics.

However look at that big distortion bump around 170 Hz. What’s going on there? The short answer is nothing – it is a measurement error. To see this, look at the frequency response:

See that dip at 170 Hz? It’s caused by a null. Its wavelength matches twice the distance from the speakers to the front wall. With dipoles, the back radiation is inverted polarity from the front, so its cancels at that frequency, creating a null. Note that this null exactly matches the frequency where the distortion graph bumps. That’s no coincidence!

When REW runs the frequency sweep, the response picked up by the microphone dips at 170 Hz. Distortion is the ratio of higher frequencies to the fundamental, and when the fundamental drops, that ratio jumps even if the higher frequencies (distortion) remains constant.

On a similar vein, the graphs show small distortion bumps at 450 and 600 Hz, corresponding to frequency responds dips at the same places.

A closer look reveals more subtle effects of the same cause. If the response dips at 170 Hz, then any 2nd harmonic from half that frequency won’t get picked up either, so that frequency will show a dip in 2nd harmonic. This explains the dip in the red line (2nd harmonic) at 85 Hz. Same with 3rd harmonic, and we see a dip in the orange line (3rd harmonic) at 57 Hz.

To confirm, here’s that same distortion graph shown as dbFS: absolute level instead of relative to the fundamental:

The scale shifted about 20 dB down but the shape of the curve is the key point.

Pretty cool, huh?