Tuesday, April 5, 2016

LINQ IQueryable.ToDictionary

The normal ToDictionary() method is built off of IEnumerable. If you use it with EntityFramework and IQueryable you have potential perf problems because it's using a bunch of bandwidth to select fields that just get thrown away.

Here's a smarter ToDictionary method that's built off of IQueryable and not IEnumerable. It integrates with EntityFramework to ensure that you select only the minimal number of columns needed, instead of fetching them all and projecting out only two columns after everything's in memory.

Usage:

var colorDictionary = this.Db.Items.ToDictionary(x => x.Id, x => x.Color); 
// results in the following SQL:

// SELECT 

//     [Extent1].[Id] AS [Id], 

//     [Extent1].[Color] AS [Color]

//     FROM [dbo].[Item] AS [Extent1]


Code:


    public static class IQueryableExtensions

    {

        public static IDictionary<KeyType, ValueType> ToDictionary<T, KeyType, ValueType>(this IQueryable<T> input, Expression<Func<T, KeyType>> keySelector, Expression<Func<T, ValueType>> valueSelector)

        {

            // deconstruct keySelector and valueSelector as member expressions

            var keyAccess = (keySelector.Body as MemberExpression)?.Member; // discard the "x => x" part of x => x.Name, retain .Name

            var valueAccess = (valueSelector.Body as MemberExpression)?.Member;

            if(keyAccess == null || valueAccess == null)

            {

                throw new ArgumentException("keySelector and valueSelector must be of the form 'x => x.MyProperty'");

            }

            var keyType = (keySelector.Body as MemberExpression).Type;

            var valueType = (valueSelector.Body as MemberExpression).Type;

            // Make a new expression, x => new Pair<keyType,valueType> { Key = x.Key, Value = x.Value }

            var pairType = typeof(Pair<,>).MakeGenericType(keyType, valueType);

            var xParam = Expression.Parameter(typeof(T));

            var newExpression =

                Expression.Lambda(

                    Expression.MemberInit(

                        Expression.New(pairType),

                        Expression.Bind(pairType.GetProperty("Key"), Expression.MakeMemberAccess(xParam, keyAccess)),

                        Expression.Bind(pairType.GetProperty("Value"), Expression.MakeMemberAccess(xParam, valueAccess))),

                    xParam)

                as Expression<Func<T, Pair<KeyType, ValueType>>>;

            var pParam = Expression.Parameter(pairType);

            return input.Select(newExpression).AsEnumerable().ToDictionary(kv => kv.Key, kv => kv.Value);

        }

        private class Pair<K, V>

        {

            public K Key { get; set; }

            public V Value { get; set; }

        }

    }


--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Wednesday, March 30, 2016

5E Magic Resistance (variant rule)

Variant rule: Magic Resistance
[This rule replaces both Monstrous Manual Magic Resistance and Legendary Resistance. Creatures with one or the other should be assigned a Magic Resistance ability and score.]

Some extremely powerful creatures strongly resist and disrupt the effects of magical energy. These creatures live and breath arcane energy, and by an act of will they can cause magic to recoil from them like water droplets skittering off a hot griddle.

A creature with Magic Resistance can apply that resistance whenever it is affected by a magical effect by expending its reaction. If there is a saving throw or attack roll involved, it can wait until the result is known before deciding to use Magic Resistance. When Magic Resistance is used, the creature makes an ability check against the DC of the magical effect (similar to Counterspell) and if the check succeeds, the magical effect is negated. Unlike Counterspell, the check need not occur at the instant of spellcasting. A Magic Resistant creature could, for example, attempt to walk through a Wall of Force, and at the instant where the Wall of Force prevents its movement, expend its reaction to dispel the Wall of Force. A Magic Resistant Creature could similarly choose at any time to resist the effects of a Maze spell holding it captive or a Planar Binding spell compelling its obedience.

Example: Esmerelda the Enchantress casts Hold Monster VII on a Balor with DC 18. It rolls an 11 on its saving throw and fails. But before the magic takes hold, the Balor resists the magic! A Balor has +12 to Charisma (Magic Resistance), and Esmerelda cast the spell at 7th level, so the Balor has to make a Charisma (Magic Resistance) roll of DC 17 to avoid being paralyzed. It rolls a 21 and shatters the spell! The spell ends, freeing the Balor and any other creatures targeted by the spell.

Note: because a reaction is required, Magic Resistance cannot be used by creatures who are surprised or incapacitated.

Note 2: because Magic Resistance is an ability check, things which affect ability checks including Hex and Cutting Words do affect Magic Resistance rolls. This is by deliberate mechanical analogy to Counterspell.

Note 3: whether things like a monk's Stunning Strike can be resisted with Magic Resistance depends on how your DM interprets whether they are magical or not. Magic Resistance is not limited strictly to spells but does apply only to things that are fundamentally magic. If the DM rules that magic resistance applies to Stunning Strike, he will also tell you what level spell each strike is equivalent to for purposes of Magic Resistance. It might be appropriate to set the level equal to the monk's proficiency bonus.

Variant: some DMs might want the players to do the rolling instead of the monsters. A mathematically-equivalent formulation to the above is: monster spends its reaction to set a DC equal to 12 + Charisma (Magic Resistance). The player then has to roll to beat that score with a bonus equal to the level of the spell. In the case of Esmerelda, she can roll at +7 to beat the Balor's DC 24. Just as before, there are 4 chances in 20 that the Balor is affected by the spell.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Saturday, March 26, 2016

WotC vs. TSR

[from another conference]

The main card gamist/WotC influences I see in 5E, relative to 2nd edition, are that:

(1) Every capability has a reified name. Whereas TSR might have written "a bard's companions get +1 to saving throws vs. charm while the bard is singing," WotC will write, "Countercharm: as an action, the bard can begin a song... non-hostile creatures get advantage vs. charm..."

(2) Capabilities are defined primarily in gamist terms. WotC will think up a mechanically-cool ability like Bardic Inspiration, Cutting Words, give it a snappy name per #1 and a place in the action economy (bonus action/reaction), and give absolutely no thought to roleplaying considerations such as just how exactly a bard is using one mouth simultaneously to give an inspiring speech to a companion (bonus action Bardic Inspiration), insult an enemy (reaction Cutting Words), and cast a spell (action Fireball) using his kazoo as an arcane focus, all in the same six seconds. As I recall 2nd edition, there was no such strong distinction between "fluff" and "crunch" (unused terms back then) because the fluff was primary: if the bard can spend an hour giving a rousing speech to his companions which heartens them against fear and boosts their morale, we know exactly what he is doing in-universe. He's not "spending his bonus action to give them a d8 Inspiration Dice" that they can later expend.

(3) There's an implicit structure to capabilities, and the writers avoid going outside the box. Capabilities are strictly-defined to avoid potentially upsetting mechanical balances, even when it's probably not necessary. Contrast 2nd edition's Tarrasque which caused fear in anything that could see it (no range limitation, although higher-level/HD creatures were less vulnerable) to 5E's Tarrasque that causes fear within some ridiculously tiny radius (120'?) that WotC writers probably think is a large radius. Is there any reason why the Tarrasque's fear should have such a small radius of effect? Were they genuinely concerned that it would be bad if the Tarrasque caused fear in things a mile away? I don't get that impression. I think they're just used to thinking of 120' as an appropriate radius for a high-level creature ability (ancient black dragon breath goes 120') that allows easy access to a "typical" medium-sized battlegrid. It's not so much, I think, that WotC would have found unlimited-range Tarrasque fear a balance problem as that they simply have no reason to break their own pattern here; 120' is enough for the scenarios they're thinking about. They're not thinking in terms of an infinite-resolution roleplaying world, they're thinking primarily in terms of their own gamist jargon.

All three of these aspects remind me of card games.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Friday, March 18, 2016

Law of Consecration

One of my favorite things about GoFundMe is that it exists. I mean that I hope and like to think that the very existence of an easy way to reach out to family and friends for help in an emergency relieves mental and emotional stress on people who are just barely getting by. I want them to know that the rest of us are there for them, even if 90% of the time they end up not needing the support.

Here's my pledge to you all:

'Therefore, ask, and ye shall receive; knock, and it shall be opened unto you; for he that asketh, receiveth; and unto him that knocketh, it shall be opened.'

I am not my Father but I will do what I can with what He gives me for whoever asks.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Election 2016

I guess I might as well show my hand RE: the 2016 election.

I disavow all candidates from both parties, Republican and Democrat. I considered Cruz for a while but I currently don't feel comfortable with him as a potential leader--too divisive.

From my perspective, the American Republic is (nearly) as dead as the Roman Republic. We're beginning the Empire phase now and the Constitution has pretty much done its job and is on its way out. I've already done my mourning over that over the course of the last decade or so, and now I'm viewing this election as a spectator. I was born in America and I think I may yet live to see her die. In some ways she has already.

But Christ was born to raise the dead.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Friday, March 4, 2016

Personal revelation

It's always interesting to see how the Spirit works in the life of Joseph Smith. There are many times when he does something, then seems to stop and ponder briefly, and then relents and reverses his course. Here are two examples, one from the memoirs of George Miller and another from Howard Coray. Interestingly, both of these involve Joseph at first deprecating or doubting himself, and the correction needed is for him to step up and magnify his calling.

Studying these accounts may help you to better understand the way the Spirit works in your own life.

Emphasis added in bold.

===============================

I had a friend in Quincy who had in one of his houses the families of Joseph Smith, Sen., Samuel H. Smith, Don Carlos Smith, Jenkins Salsbury, and a Brother Henry Hoit. He said they were all destitute and he thought gentlemen, and would suit my purpose. I waited on the venerable patriarch and those under his roof. He frankly said that his sons would take charge of my farm and effects, and praised God that I had been sent in answer to his prayers...

Getting in speaking distance, he suddenly reined up his horses as making ready to speak. I was much agitated as the words came from his mouth: "Sir, can you tell me the way to the farm of a Mr. Miller, living somewhere in the direction I am going?" Instead of answering him directly, my reply was, "I presume sir, that you are Joseph Smith, Jr., the Mormon Prophet?"

"I am, sir," he said, adding, "I also presume that you are the Mr. Miller whose farm I inquired for?" "I am, sir," I replied. He then introduced me to his wife and family.

I solicited him to preach. He excused himself as not feeling like sermonizing, having just escaped from prison; that he felt like a bird uncaged and was more disposed to reconnoiter the country and visit his friends and people. Upon my urging the matter, he suddenly turned to me, saying that he did think of some one of the elders preaching for me, but he was now resolved on doing it himself; that it had been whispered that a Samaritan had bound up the wounds of his bleeding friends, adding that he would do the best he could in the way of preaching. Accordingly the time and place was fixed upon, and I went to notify the people of the appointment of the Mormon Prophet to preach.

================================

In June, 1841, I met with an accident. The Prophet and I, after looking at his horses and admiring them across the road from his house, started thither. The Prophet at the same time put his arm over my shoulder. When we had reached about the middle of the road, he stopped and remarked, "Brother Coray, I wish you were a little larger. I would like to have some fun with you."

I replied, "Perhaps you can as it is"—not realizing what I was saying. The fact that Joseph was a man of over 200 lb., while I was scarcely 130 lb., made it not a little ridiculous for me to think of engaging with him in anything like a scuffle.

However, as soon as I made this reply, he began to trip me. He took some kind of a lock on my right leg, from which I was unable to extricate it, and throwing me around broke it some three inches above the ankle joint.

He immediately carried me into the house, pulled off my boot, and found at once that my leg was decidedly broken; then got some splinters and bandaged it. A number of times that day he came in to see me, endeavoring to console me as much as possible.

The next day when he happened in to see me after a little conversation, I said: "Brother Joseph, when Jacob wrestled with the angel and was lamed by him, the angel blessed him. Now I think I am also entitled to a blessing."

To that he replied, "I am not the Patriarch, but my father is, and when you get up and around, I'll have him bless you".

He said no more for a minute or so. Then, looking very earnestly at me, he declared, "Brother Coray, you will soon find a companion, one that will be suited to your condition and whom you will be satisfied with. She will cling to you like the cords of death; and you will have a good many children."

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Umbilical cord cutting: effects on health

Fascinating. I had no idea this debate on cord-clamping even existed.

In the study, a group of 263 healthy Swedish full-term babies were randomly split into two groups. One group had their umbilical cords clamped less than 10 seconds after birth. The cords of the other group were clamped three minutes after birth. The two groups were then monitored for four years. The babies with delayed cord clamping performed modestly better on tests assessing their fine motor skills and social skills. The boys in the study displayed the most statistical improvement. The results, researchers say, showed no difference in overall IQ.

http://www.cnn.com/2015/05/29/health/cut-the-cord/

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Thursday, March 3, 2016

Spiritual lessons

Dear J.,

Here's an interesting event. In real life, I recently (within the past 3-5 years) lost a relationship of great value to me. I think I'm okay with this because I did everything I could for s'her while I had the opportunity. But anyway, the point is that today I lost an object of great physical value to me (my wallet). I did the normal thing of checking possible places where it could have fallen out, praying for help to be clear-minded, etc. Still no luck.

Prompted by the Spirit, I felt like this might be one of those times where you just have to write it off and move on with life. So I prepared to leave for work, pulling out some socks from my drawer and thinking about how I might check for the missing wallet at work and the drop by the bank afterwards to begin the process of replacing everything. And also prompted by the Spirit, I said another prayer, not asking this time for help finding it or being clear minded or anything, but just to learn whatever it was that I need to learn from the experience.

And I went to the kitchen table to put my socks and shoes on, and pulled out the chair to sit on... and the wallet was there on the chair. Somehow it had fallen out of my back pocket last night while playing D&D. And... huh. Five seconds after the prayer, and there it is? And now I don't have to go through all the not-tragic but not-fun experiences I was anticipating. Was the lesson completed by the fact that I was willing to stop wanting it? I did ask to learn what I needed to learn, and that's what came immediately to mind...

So I paused for a moment to write this note so I don't forget. Tentatively, what I'm getting out of this is, if I had to translate it into words, "Move forward. But don't worry, be happy." I think I'm making the right choices. BTW, that doesn't mean I expect to get that relationship back. But I do expect to feel perfectly okay in a few years about letting s'her go.

-Max

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Saturday, February 27, 2016

Recognizing revelation

Link.

I was about to state my own take on the subject and then realized that I would just be repeating Brigham Young almost word-for-word.

"If I do not know the will of my Father, and what He requires of me in a certain transaction, if I ask Him to give me wisdom concerning any requirement in my life, or in regard to my own course, or that of my friends, my family, my children, or those that I preside over, and get no answer from Him, and then do the very best that my judgement will teach me, He is bound to own and honor that transaction, and He will do so to all intents and purposes." -Brigham Young

Also, I think Elder Bednar says something really important at 5:16.

-Max

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Friday, February 19, 2016

Apple/FBI controversy

I found this an interesting offer from John McAfee:

"So here is my offer to the FBI. I will, free of charge, decrypt the information on the San Bernardino phone, with my team. We will primarily use social engineering, and it will take us three weeks. If you accept my offer, then you will not need to ask Apple to place a back door in its product, which will be the beginning of the end of America."


-Max

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Monday, February 15, 2016

Workers and robots

Providing gainful employment for everyone is the defining economic challenge of the 21st century. I do not believe the answer lies in capitalism, communism, or socialism. The only feasible answer I know of lies in widespread voluntary obedience to the Law of Consecration.

So, that's the solution. The below excerpt from this article tells you a bit more about the problem.

Vardi insisted that even if machines make life easier, humanity will face an existential challenge.

"I do not find this a promising future, as I do not find the prospect of leisure-only life appealing," he said. "I believe that work is essential to human wellbeing."

*snip*

Last year, the consultant company McKinsey published research about which jobs are at risk thanks to intelligent machines, and found that some jobs – or at least well-paid careers like doctors and hedge fund managers – are better protected than others. Less intuitively, the researchers also concluded that some low-paying jobs, including landscapers and health aides, are also less likely to be changed than others.

In contrast, they concluded that 20% of a CEO's working time could be automated with existing technologies, and nearly 80% of a file clerk's job could be automated. Their research dovetails with Vardi's worst-case scenario predictions, however; they argued that as much as 45% of the work people are paid to do could be automated by existing technology.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Thursday, February 11, 2016

Road From Republic To Empire

A truly insightful article. Selected excerpts below but I recommend the whole thing. -Max


There is in the Anglo-American tradition a clear precedent for the executive's power to suspend the law. Under the royal "prerogative of suspension," the British monarch could summarily "suspend" the operation of any law at any time. The Glorious Revolution of 1688 did away with that power. And as we know from the records of the Philadelphia Convention, the original Constitution carefully circumscribed the veto precisely in order to ensure that the president would never exercise such a power. So how far does this newfound suspension power go? Think about the business-mandate penalty in Obamacare: Unless you're a small company, you have to offer health insurance to your employees or pay a $3,000 tax. The tax liability is created by operation of law, but Obama announced that it wouldn't be collected for several years, and — abracadabra — the liability vanished from financial statements across the land.

So if Obama can eliminate statutory tax obligations by the stroke of a pen, would a future Republican president be able to eliminate taxes that he doesn't like, such as the capital-gains or corporate-income tax? Obama was asked that question in a 60 Minutes interview, and he answered simply, "No." He didn't explain why not, but the reason is not hard to divine: There was public support for both the immigration order and the business-mandate suspension, whereas a unilateral suspension of the capital-gains tax would probably be deeply unpopular. Thus, the only constraint on this newfound suspension power is political, not constitutional. That's in harmony with the view of left-wing law professors such as Adrian Vermeule and Eric Posner, who believe that Congress could delegate all legislative authority to the president, without concern for the Constitution's separation of powers, because political constraints will be enough to prevent the establishment of a dictatorship. One wonders if Vermeule and Posner are having second thoughts now. "Shame is our most powerful restraint on politicians who would find success through demagoguery," wrote Ezra Klein at Vox. But of course that's no restraint at all for a demagogue, which was the point of constitutional limits. 

Most Americans probably don't realize that only a small fraction of our laws are passed by Congress. The vast majority are enacted as "rulemaking" by regulatory agencies in the executive branch, pursuant to congressional delegations of legislative authority. The Obama administration has been particularly virulent in this respect, with executive agencies such as the Environmental Protection Agency enacting transformative regulations that would never pass in any Congress. In the case of Yakus v. United States (1944), the Supreme Court decided that it didn't need to worry about Congress's delegation of legislative authority to the executive branch, because both Congress and the federal courts were in a position to police what the executive does with those delegations. This rationale has been abundantly refuted in the decades since. Congress is never in a position to block an agency rule, except in the rare circumstance that the president's own party rebels against him. And the Court uses the pose of "deference" to justify letting the political branches do exactly as they please, concerned most of all with preserving the Court's own popular legitimacy.

The Congress that wrote the Clean Air Act would never have imagined that the EPA would one day use it to seize control of America's electricity generation from the states, as its Clean Power Plan envisions. Yet now, even a large majority of Congress can't stop the rule. Normally, a two-thirds majority is required to pass a bill over a presidential veto, but delegation flips that obstacle upside down: In the case of agency rules, a two-thirds majority is required to block a regulation over the president's veto. Through a clever delegation, any president can collude with Congress to impose law on future Congresses. That is exactly the purpose of the new Consumer Financial Protection Bureau under Dodd-Frank. The CFPB will be creating law and adjudicating on autopilot, with its own revenue stream, subject to no political control whatsoever, until a president and a congressional supermajority can combine to kill it.

With Congress powerless to stop what the president does with delegated authorities, the last line of defense is the federal courts. That, alas, has proved to be no defense at all. In the case of Chevron v. Natural Resources Defense Council (1984), the Supreme Court ruled that an executive agency's interpretation of its own enabling statute is due broad deference, if there is any "rational basis" at all for that interpretation. Incredibly, the Chevron rule even applies to agency determinations regarding the scope of their own powers. Many Americans would be embarrassed to learn (as I was in law school) the contortions of sophistry and solipsism that federal courts are willing to perform in order to let agencies escape the limits in their enabling statutes. Chevron contains another lesson, too: It was hailed at the time as a victory for Ronald Reagan against crusading environmentalists, because political short-sightedness afflicts us all. The Supreme Court dealt the EPA's clean-power plan a potentially fatal blow this week, when it decided to delay implementation of the rule until the legal challenges have run their course, but that is a function of Obama's appetite for testing the high court's deference to the limit.

*snip*

The progressive cookbook is full of recipes for the dictator of the future. Take, for example, Obama's masterful use of regulatory uncertainty to achieve his goals, in defiance not just of Congress but of the federal courts. In the months after the Gulf oil spill, Obama imposed a moratorium on all offshore drilling, despite the fact that most of those operations were at stages of drilling in which there was virtually no chance of a spill. When one court tossed the moratorium out, the Obama administration came back with a modified version that actually expanded the moratorium; and by the time that one was tossed out, Obama simply slow-walked the needed permits. He had achieved his objective, which was to chase most of the Gulf's deep-sea drilling rigs to other parts of the world.

Obama has demonstrated a willingness to use his constitutional powers against political opponents, as shown by the IRS persecution of tea-party groups, and by selective prosecutions — for example, targeting Senator Bob Menendez for accepting favors in connection with official duties, but not Hillary Clinton; or General David Petraeus for misuse of classified information, but not Hillary Clinton. Only Obama's forbearance and wisdom, such as they are, have kept him from taking the approach of Vladimir Putin and Hugo Chávez and overtly intimidating critics by threatening their economic interests. With that in mind, consider Donald Trump's attempt, before a recent Fox News GOP debate, to get anchor Megyn Kelly fired, or at least withdrawn from moderating the debate, as a condition of his participation. Imagine what he might do once armed with the powers of Obama's post-constitutional presidency.

Read more at: http://www.nationalreview.com/article/431135/donald-trump-dictatorship-american-style

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Tuesday, February 9, 2016

On Racism in America

Suddenly I understand why Ta-Nehisi Coates has fans. So THAT's what Critical Race Theory is!

From comments on http://heterodoxacademy.org/2016/02/03/antiracism/

'In truth the Golden Calf of AR which is now worshiped, fatted calf and all, has little to do with actual Racism ("The belief that all members of a given race possess characteristics specific to that race, especially so as to distinguish it as inferior") and much to do, instead, with Progressively Mythological Racism or, by another name, Critical Race Theory. This, of course, would be the sacred & unquestioned belief that every social/political/economic/cultural structure within Western Civilization (particularly as expressed within the United States) is fatally flawed/infected with Anti-Blackism.'

-B.C.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Saturday, February 6, 2016

On Race and IQ

[Originally posted on Facebook]

Look, here's a quick lesson on race, what it is and isn't:

Ashkenazi Jews have the highest IQ on the planet of any distinct ethnic group. They average a full standard deviation above the human average; the average Ashkenazi is in the top 32% of the human race intellectually.

The Wilson family is a lot smarter than that. Probably a full standard deviation above the Ashkenazi, as a whole.

There are other families out there who are smarter than the Wilsons. Many of them are Ashkenazi. But none of these families constitute a recognized ethnic group, so they don't count as "races." "Race" is ultimately a social construct built on hereditary genetic reality--genes are real, but society dictates when you get to call a family a "race" or not.*

Any given Ashkenazi is probably smarter than the average person. Any given Wilson (or Pesin, or Cochran, or Hunter, or whomever) is probably smarter than the average Ashkenazi. Any given person who is smarter than a Wilson/Pesin/Cochran/Hunter is disproportionately likely to be an Ashkenazi; but most people smarter than Wilsons/Pesins/Cochrans/Hunters are not Ashkenazi, because they're still a tiny minority.

"Race" tells you something, but it's not as specific as family, and specific data always tells you more than broad generalizations. (See what I did there? "Always.") The most specific data comes from studying the specific individual.

* Of course, you don't have to listen to society. In my own head, I can legitimately consider myself the founder of a race of Wilsons, even if there's only one of us so far.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Ethical science

You may find this inspirational:

It's a natural byproduct of science conducted as a public good. Normal people really appreciate good science that's done in their interest...  I am very concerned about the culture of academia in this country and the perverse incentives that are given to young faculty. The pressures to get funding are just extraordinary. We're all on this hedonistic treadmill — pursuing funding, pursuing fame, pursuing h-index — and the idea of science as a public good is being lost.

This is something that I'm upset about deeply. I've kind of dedicated my career to try to raise awareness about this. I'm losing a lot of friends. People don't want to hear this. But we have to get this fixed, and fixed fast, or else we are going to lose this symbiotic relationship with the public. They will stop supporting us.

-Max

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Wednesday, February 3, 2016

D&D clerics

Dante,

Look at this.

This post nails exactly why I hate D&D clerics. They're antithetical to my personality and I could not play one effectively, because I can't respect them intellectually:

Clerics were (and always have been!) the comic fanboys of their nations.

They gather in comic book shop temples, gather at huge comic-cons to worship, and war endlessly online with members of other faiths. Can Superman beat Batman? Is the new DC line awesome or terrible? Will the newnew DC line be terrible or awesome? (Protip: Don't get hopes up.)

People have always been talking and telling stories about characters that are greater then men are. Is a god popular? Then his legend changes, with a heel/face turn, or perhaps the opposite when they fall out of fashion.

[snip]

That's what the cleric is doing. He's reading the latest issue and arguing over it with the other members of the clergy. The higher ups are crafting new stories and tales and altering the old ones for new people in changing times.

The interaction with the pantheon is much the same. A fan of Captain America doesn't disbelieve in Thor. Thor and Cap hang out together all the time. Sometimes they are on the same side, and sometimes they fight. What's important is that you're a fan of Marvel and not those [crummy] DC heroes.

Insightful, no?

-Max

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Friday, January 22, 2016

Psychology of work

Some fascinating ideas here. Selected quotes:

"Assume You're Going Home at 5:30, Then Plan Your Day Backwards."

"Over and over, scientists see that the perception of control over a stressor alters the stressor's impact."

"He insists that although most Americans feel they're working harder than ever, they aren't. The time diaries he studies show that average hours on the job, not only in the United States but also around the globe, have actually been holding steady or going down in the last forty years. Everybody, he says, has more time for leisure. So what gives? It feels like you have no time because it's so fragmented with little annoying tasks that drain the life out of you."

"Shallow work is little stuff like email, meetings, moving information around. Things that are not really using your talents. Deep work pushes your current abilities to their limits. It produces high value results and improves your skills."

And from a related page:

"If while you're making your argument, the only time the other side is silent is because they're thinking about their own argument, they've got a voice in their head that's talking to them. They're not listening to you. When they're making their argument to you, you're thinking about your argument, that's the voice in your head that's talking to you. So it's very much like dealing with a schizophrenic. If your first objective in the negotiation, instead of making your argument, is to hear the other side out, that's the only way you can quiet the voice in the other guy's mind."

-Max

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Thursday, January 21, 2016

XP comparison

Table 1
Additional XP required to advance to next level in AD&D 2nd edition
Level Fighter Paladin Cleric Wizard
1 2000 2250 1500 2500
2 2000 2250 1500 2500
3 4000 4500 3000 5000
4 8000 9000 7000 10000
5 16000 18000 14500 20000
6 32000 34000 27500 20000
7 61000 75000 55000 30000
8 125000 150000 110000 45000
9 250000 300000 225000 115000
10 250000 300000 225000 125000

Table 2
XP per hit dice in AD&D 2nd edition
HD XP
1 15
2 35
3 65
4 120
5 175
6 270
7 420
8 650
9 975
10 1400

Table 3
Same-level monsters required to advance to next level in AD&D 2nd edition (table 1 divided by table 2)
Level Fighter Paladin Cleric Wizard
1 134 150 100 167
2 58 65 43 72
3 62 70 47 77
4 67 75 59 84
5 92 103 83 115
6 119 126 102 75
7 146 179 131 72
8 193 231 170 70
9 257 308 231 118
10 179 215 161 90

Table 4
5E XP for AD&D 2nd edition-equivalent monster
(AD&D orcs were weaker relative to PCs than a 5E orc, so I'm using CR=two steps below level as an equivalent for equal HD even though that makes AD&D orcs equivalent CR 1/4 monsters instead of CR 1/2)
PC level Equivalent CR XP
1 0.25 25
2 0.5 50
3 1 100
4 2 200
5 3 450
6 4 700
7 5 1100
8 6 1800
9 7 2300
10 8 2900

Table 5
AD&D 2nd edition-equivalent level advancement tables in 5E (table 3 times table 4)
How many 5E XP monster experience a 2nd edition PC would need to earn to advance to the next level
Level Fighter Paladin Cleric Wizard
1 3350 3750 2500 4175
2 2900 3250 2150 3600
3 6200 7000 4700 7700
4 13400 15000 11800 16800
5 41400 46350 37350 51750
6 83300 88200 71400 52500
7 160600 196900 144100 79200
8 347400 415800 306000 126000
9 591100 708400 531300 271400
10 519100 623500 466900 261000

Table 6
Additional XP required to advance to next level in 5th edition
Level XP
1 300
2 600
3 1800
4 3800
5 7500
6 9000
7 11000
8 14000
9 26000
10 21000

Table 7
(Rough measure of) How much faster advancement is in D&D 5th edition than AD&D 2nd edition (table 5 divided by table 6)
Level Fighter Paladin Cleric Wizard
1 11.17 12.5 8.33 13.92
2 4.83 5.42 3.58 6.0
3 3.44 3.89 2.61 4.28
4 3.53 3.95 3.11 4.42
5 5.52 6.18 4.98 6.9
6 9.26 9.8 7.93 5.83
7 14.6 17.9 13.1 7.2
8 24.81 29.7 21.86 9.0
9 22.73 27.25 20.43 10.44
10 24.72 29.69 22.23 12.43
Table 1
Additional XP required to advance to next level in AD&D 2nd edition
Level Fighter Paladin Cleric Wizard
1     2000    2250    1500    2500
2     2000    2250    1500    2500
3     4000    4500    3000    5000
4     8000    9000    7000    10000
5     16000   18000   14500   20000
6     32000   34000   27500   20000
7     61000   75000   55000   30000
8     125000  150000  110000  45000
9     250000  300000  225000  115000
10    250000  300000  225000  125000

Table 2
XP per hit dice in AD&D 2nd edition
HD  XP
1   15
2   35
3   65
4   120
5   175
6   270
7   420
8   650
9   975
10  1400

Table 3
Same-level monsters required to advance to next level in AD&D 2nd edition (table 1 divided by table 2)
Level Fighter Paladin Cleric  Wizard
1     134     150     100     167
2     58      65      43      72
3     62      70      47      77
4     67      75      59      84
5     92      103     83      115
6     119     126     102     75
7     146     179     131     72
8     193     231     170     70
9     257     308     231     118
10    179     215     161     90

Table 4
5E XP for AD&D 2nd edition-equivalent monster
(AD&D orcs were weaker relative to PCs than a 5E orc, so I'm using CR=two steps below level as an equivalent for equal HD even though that makes AD&D orcs equivalent CR 1/4 monsters instead of CR 1/2)
PC level  Equivalent CR   XP
1         0.25            25
2         0.5             50
3         1               100
4         2               200
5         3               450
6         4               700
7         5               1100
8         6               1800
9         7               2300
10        8               2900

Table 5
AD&D 2nd edition-equivalent level advancement tables in 5E (table 3 times table 4)
How many 5E XP monster experience a 2nd edition PC would need to earn to advance to the next level
Level Fighter Paladin Cleric  Wizard
1     3350    3750    2500    4175
2     2900    3250    2150    3600
3     6200    7000    4700    7700
4     13400   15000   11800   16800
5     41400   46350   37350   51750
6     83300   88200   71400   52500
7     160600  196900  144100  79200
8     347400  415800  306000  126000
9     591100  708400  531300  271400
10    519100  623500  466900  261000

Table 6
Additional XP required to advance to next level in 5th edition
Level XP
1     300
2     600
3     1800
4     3800
5     7500
6     9000
7     11000
8     14000
9     26000
10    21000

Table 7
(Rough measure of) How much faster advancement is in D&D 5th edition than AD&D 2nd edition (table 5 divided by table 6)
Level Fighter Paladin Cleric  Wizard
1     11.17   12.5    8.33    13.92
2     4.83    5.42    3.58    6.0
3     3.44    3.89    2.61    4.28
4     3.53    3.95    3.11    4.42
5     5.52    6.18    4.98    6.9
6     9.26    9.8     7.93    5.83
7     14.6    17.9    13.1    7.2
8     24.81   29.7    21.86   9.0
9     22.73   27.25   20.43   10.44
10    24.72   29.69   22.23   12.43

Tuesday, January 19, 2016

Git whitespace

Required reading to understand git whitespace errors and end-of-line characters:

http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/

-Max

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Saturday, December 26, 2015

Sounds

Merry Christmas!

https://soundcloud.com/maximilian-wilson/christmasstorymp3

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Tuesday, December 15, 2015

Hybrid frogs

J.,

Whoa. Apparently these frogs have only halfway speciated.

P. esculentus ( genome RL) generally produces offspring by mating with another species, usually P. lessonae. In most populations, they produce gametes that only contain the R genome (the L genome is discarded): mating with P. Lessonae restores the L genome. Presto, more hybrids.

They can mate with others of their kind, but few tadpoles survive – essentially because the parental genome (R) does not go through sexual recombination – thus mutations have accumulated over the many generations since the original hybridization. Muller's ratchet.

In eastern Europe, it's the other way around: the L genome is clonal and the hybrids have to mate with P. ridibundus, with complex results (3/4 hybrids, 1/4 pure ridibundus).

Crazy, huh?

-Max


--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Tuesday, December 1, 2015

Beatitudes

Hey,

I just realized this morning that these thoughts (in 3 Nephi 12) are all connected:

11 And blessed are ye when men shall revile you and persecute, and shall say all manner of evil against you falsely, for my sake;

12 For ye shall have great joy and be exceedingly glad, for great shall be your reward in heaven; for so persecuted they the prophets who were before you.

13 Verily, verily, I say unto you, I give unto you to be the salt of the earth; but if the salt shall lose its savor wherewith shall the earth be salted? The salt shall be thenceforth good for nothing, but to be cast out and to be trodden under foot of men.

14 Verily, verily, I say unto you, I give unto you to be the light of this people. A city that is set on a hill cannot be hid.

In other words, when men revile against you falsely, turn the other cheek. It is tempting (especially for me!) to get crabby and point out how the other party is being intellectually dishonest. That is the spirit of pride/enmity/contention, and giving in to it is akin to salt losing its savor. Rather, the Savior gives unto us to be the light of the world in maintaining charity and good humor even in the face of unjust persecution. Instead of fighting fire with fire, he urges us to live by the spirit, and "A city that is set on a hill cannot be hid." Those with eyes to see will see.

Remind me of this please, next time I get crabby about straw men. :)

-Max

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Monday, November 30, 2015

Santa Claus

I wouldn't be comfortable telling my kids that Santa wasn't real, because it would feel like a lie. I'd say, "Santa is metaphorically real, not a literal physical presence. Santa Claus is a collective identity for those who wish to do good with plausible deniability, a sort of nom de guerre if you will, a name which can legitimately be assumed for a time by anyone who wishes to do good anonymously, in company with others who are doing the same. You can legitimately claim to be Santa instead of yourself whenever you are doing the things that Santa Claus would do."

If they look confused at that, I'll give them the shorter summary: "I'll explain it when you're older."

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Friday, November 27, 2015

Daesh/ISIS and existential threats

Dear J.,

There's a medium-sized fight going on right now in the policy space about whether to prioritize military spending or fiscal prudence, and whether or not the U.S. should get involved directly in fighting Daesh/ISIS in Syria. I don't know if you've heard about that fight, but a major decision factor is whether or not ISIS is an existential threat to the U.S. or if that is just panicky overreaction to a threat which is still far militarily weaker than, say, Italy.

For me, here's the thing about Daesh/ISIS: I don't know if they're an existential threat to the U.S. because I don't know what it would take to destroy us, practically speaking. I don't know why the economy works in the first place and I don't know what it would take to break it. Say somebody launches a cyber attack that takes down 50% of the power plants in the U.S. for six months and crashes the databases of half of the Fortune 500 companies, losing a lot of financial data in the process. Or if somebody does an EMP over New York, and another over Los Angeles, that destroys 90% of all electronics in those areas. Neither of these things will physically kill all the people in the U.S., but does either of them push us into a Great Depression? My answer: I have no idea. I can believe in scenario where we're up and running again in a year, and I can believe in a scenario where the country dissolves into mass chaos (unemployment, Ferguson-style rioting, martial law declared, backlash against martial law). I don't REALLY believe in the mass chaos scenario, in the same way that as a kid I never really thought my parents would get a divorce, but that disbelief is founded more in emotional inertia than logical analysis.

I don't know if Daesh/ISIS is an existential threat because I don't know what an existential threat to the nation looks like any more. We're fragile.

See also 3 Nephi 8, where the murder of the chief judge destroyed the government: "And the people were divided one against another; and they did separate one from another into tribes, every man according to his family and his kindred and friends; and thus they did destroy the government of the land." Looking at the fault lines in America, that pattern (in response to a different stimulus) is not at all implausible. I guess we'll see, huh?

Happy American Thanksgiving, by the way! See you tomorrow.

Love,
M.


--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Monday, November 9, 2015

Enmity

Dear Y.A.

I want to share an experience with you.

In Elders' Quorum yesterday, re-reading President Benson's definition of "enmity" really brought something home to me. I don't really do "hatred" enmity, but he also includes "a state of opposition," and when arguments occur (about anything) I'm quite easily inclined to think, "No, what you're asking for won't work the way you think and is a bad idea. We shouldn't do that" which actually does qualify as "a state of opposition" and therefore enmity and therefore pride.

So I need to find a way to hold my opinions without opposition, without thinking to myself, "I don't want you to get what you are asking for." Non-religious example: gun control. I think trying to ban guns in the U.S. would be horribly counterproductive and just punishes law-abiders with more hassle without actually making anyone safer; but when someone starts talking about "gun crime," I need to not oppose them and want to gripe about their desires. Instead, I should find a way to disagree without opposing, which tends to emphasize areas of agreement and possible compromise. I don't have to think, "I hope you manage to ban guns in the U.S." but I CAN think, "I really value the culture of freedom in the U.S., and I value simple laws that people can actually keep. I hope you find a way to get what you want in terms of increased safety for everyone without compromising the things that I value." If I can do that I will avoid feelings of enmity and therefore pride.

It seems to me that the primary "re-thinking" the Church has done in recent years is to studiously avoid encouraging any kind of enmity or opposition between its members and gay activists. That doesn't mean that some people won't take offense anyway, but I do see a pattern of trying very hard to avoid opposition and seek mutually-agreeable compromises. Presumably this same approach would be taken by the Church on any potentially-contentious issue, not just this one. It's an emphasis on charity.

Hope you're doing great. I love you!

-B.C.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Sunday, November 8, 2015

Git magic, git

Written by Dan Glick:

You remind me of the branch
What branch? branch with the code
What code? code that hasn't shipped
Ship who? ship you
You do? remind me of the branch

My code was in too many folder trees, oh my
What could I do
My code was so spread out, and what were actual diffs?
Nobody knew

What kind of source control to use
SVN
or TFS
Maybe Perforce
Then somebody said

Git magic, git magic
Git magic, git magic
Pull my push and merge my change
Cherry-pick my commit range
DAG magic, DAG magic
DAG magic, DAG magic
Careful with rebase and squash
Pull the tip before you push

I couldn't find the hotfixes from prod
What could I do
Each file had conflicts left and right, and how to merge?
Nobody knew

What kind of source control to use
CVS
or VSS
Source Depot? Never!
Then somebody said

Git magic, git magic
etc.


--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Saturday, November 7, 2015

An Entire Separation

November, 2015

Dear Y.A.,

I sometimes see people ominously speaking of what the Church needs to do "to survive", and threatening ("more in sorrow than in anger") a mass exodus of their presumably legion like-minded cohorts if certain doctrinal changes are not made to their liking. I find this a striking, and surprising, fulfillment of the words written in 1831, in the Doctrine and Covenants, Section 63:

"These things are the things that ye must look for; and, speaking after the manner of the Lord, they are now nigh at hand, and in a time to come, even in the day of the coming of the Son of Man. And until that hour there will be foolish virgins among the wise; and at that hour cometh an entire separation of the righteous and the wicked..."

I never could have imagined that the "entire separation" would happen THIS way. I always sort of expected to see the foolish virgins fall away in fatigue or embarrassment when faced with mockery and persecution and the need to sacrifice; it never occurred to me that they would threaten to hurl themselves out of the Church as a form of coercion against God.

We are always sad to see anyone leave, and yet no one can say the Lord never warned us that it was coming. Matthew 24:24. "For there shall arise false Christs, and false prophets, and shall shew great signs and wonders; insomuch that, if it were possible, they shall deceive the very elect." Our job is to make sure that, at least for ourselves, it is NOT possible to be deceived. Read your scriptures, say your prayers, listen to the Spirit. Amen, amen.

I love you! Good luck.

~B.C.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.

Tuesday, October 20, 2015

Stupor of Thought

"But, behold, I say unto you, that you must study it out in your mind; then you must ask me if it be right, and if it is right I will cause that your bosom shall burn within you; therefore, you shall feel that it is right. But if it be not right you shall have no such feelings, but you shall have a stupor of thought that shall cause you to forget the thing which is wrong."

One thing you need to know about the Holy Ghost in order to understand revelation is that God is never, ever pedantic in his corrections. He will never tell you you're wrong in an minor detail that you weren't intending to ask about. This is why the 1830 edition of the Book of Mormon has grammatical errors, and this is (one reason) why even plans you've made with inspired guidance need course corrections over time. If you're on the right track, the Holy Ghost will tell you to move forward even if you're 10 or 15 degrees off at first.

--
If I esteem mankind to be in error, shall I bear them down? No. I will lift them up, and in their own way too, if I cannot persuade them my way is better; and I will not seek to compel any man to believe as I do, only by the force of reasoning, for truth will cut its own way.

I could not love thee, dear, so much,
Loved I not Honor more.