The Daily Parker

Politics, Weather, Photography, and the Dog

A is for Assembly

Welcome to the Daily Parker's 2018 Blogging A-to-Z challenge!

Blogging A to ZWe're starting today with a fundamental concept in Microsoft .NET software development: the Assembly.

Microsoft defines the assembly as "a .dll or .exe file that can contain a collection of APIs that can be called by apps or other assemblies." In other words, an assembly is the basic unit of delivering .NET software to the rest of the world. An assembly "fully describe[s] and contain[s] .NET programs."

When you compile .NET source code, the compiler creates one or more of these files, each of with contains an Intermediate Language (IL) representation of your original code. You can then distribute the .dll or .exe files to any computer that has the correct version of the .NET Common Language Runtime (CLR) installed on it.

I've created a Visual Studio solution for this challenge. Today we're looking just at one small piece of it, which looks like this:

using System;

// ReSharper disable CheckNamespace
namespace InnerDrive.DailyParkerAtoZ.HelloWorld
{
	internal static class Program
	{
		// ReSharper disable once UnusedParameter.Local
		private static void Main(string[] args)
		{
			Console.WriteLine("Hello, World!");
			Console.ReadKey();
		}
	}
}

If you're new to .NET, don't worry about all the pieces. This two-line program compiles into an assembly called HelloWorld.exe, which internally looks like this:

.method private hidebysig static void  Main(string[] args) cil managed
{
  .entrypoint
  // Code size       19 (0x13)
  .maxstack  8
  IL_0000:  nop
  IL_0001:  ldstr      "Hello, World!"
  IL_0006:  call       void [mscorlib]System.Console::WriteLine(string)
  IL_000b:  nop
  IL_000c:  call       valuetype [mscorlib]System.ConsoleKeyInfo [mscorlib]System.Console::ReadKey()
  IL_0011:  pop
  IL_0012:  ret
} // end of method Program::Main

Again—we're not going to get into a lot here. Suffice to say, that IL above is what actually lives in the assembly, and what the CLR will execute when you run the program. The assembly also contains a manifest, describing what it contains, and some metadata about its version, author, and whatever else the programming team has added to the assembly info file.

As with all of the topics for this year's A-to-Z challenge, I'm only scratching the surface. There is a ton more to read online and in some solid books on the market. The best information about assemblies I've found is in Jeffrey Richter's CLR via C#.

Note: the Visual Studio Solution for this challenge requires Visual Studio 2017 and the .NET Framework v4.7. ReSharper is also recommended.

Tuesday link round-up

Late afternoon on Tuesday, with so much to do before the end of the week, I can only hope actually to read these articles that have passed through my inbox today:

And now for something completely different tonight: Improv and Arias. Which is why I wonder whether I'll actually get to read all of the articles I just posted about.

1.5 Gs

As of just a few moments ago, I passed 1.5 billion seconds old.

Yes, this is a thing most people don't really think about, but as someone who works in software, this actually has some significance—and another Y2K problem that will occur just a few months before I get to 2.0 Gigaseconds (Gs) in 2038.

The problem is a thing called the Unix epoch. Computers can only count as high as they have bits to count. Unix computers, which include Macs and most of the infrastructure of the Internet, count time in seconds from 1 January 1970 00:00 UTC, which was (at the moment I'm typing this) 1,521,383,994 seconds ago.

Everyone knows computers can count to awesomely huge numbers. But you need to give them enough bits to do that. Unix time is measured by a 32-bit number, which can count up to 232-1, or 4,294,967,295 (in binary, a 32-item string of 1s), which is enough seconds to count just over 136 years.

But you sometimes want to measure things that happened in the past, so Unix time takes the first bit of the 32-bit number and makes it a sign. If the first bit is 0, the time is in the present. If it's 1, the time is the number of seconds before the beginning of the epoch. So this cuts the measurable period in half, to 68 years. Specifically, Unix time rolls over at 3:14:08 on 19 January 2038.

The fix is simply to use a bigger number. Today, 64-bit numbers are no big deal, and they give you 263-1 (9,223,372,036,854,775,807) seconds to work with in either direction. That's roughly 292 billion years, which is sufficient to measure most human-scale activities.

So, knowing all this, and knowing that I was born in the first year of the Unix epoch, it wasn't difficult to figure out my "epoch" birth moment at 9:12 CDT this morning.

But there's a catch. As I mentioned, computers count by 2s, not by 10s, so this entire post is a lie. I'm not 1.5 Gs old; I'm just over 1,500,000,000 seconds old. 1.5 x 230 (i.e., 1.5 giga anything) is 1,610,612,736, so I won't be 1.5 Gs old until Unix moment 1,631,995,056, which will be 18 September 2021 at 19:57:36 UTC.

So check back in three and a half years. I'm sure I'll have another post about this nonsense then.

(For those of you keeping score at home, I was 1.0 Gs old on 13 September 2004 at 20:09:04 CDT, during a lull in blogging. Else I'm sure I would have mentioned this then.)

Long weekend; just catching up

Saturday and Sunday, the Apollo Chorus sang Verdi's "Requiem" three times in its entirety (one dress rehearsal, two performances), not including going back over specific passages before Sunday's performance to clean up some bits. So I'm a little tired.

Here are some of the things I haven't had time to read yet:

Other stuff is going on, which I'll report when I have confirmation.

Function following forms

Designer Josh Gee spent two years trying to put Boston city government forms online:

Getting city workers to accept online submissions rather than traditional paper ones is the bulk of this work. On average, it took me about 30 minutes to make a digital form and five weeks to meet with, earn the trust of, and get buy-in from the employees who would use it. Even if they were excited, the nitty gritty details took a lot of back and forth.

While I avoided a bunch of process change, there were some takeaways that I think are useful for anyone working to move government forms online:

  • There is huge demand to move forms online — I had expected to drag departments online kicking and screaming. Instead, the majority of departments were eager to move things online and thrilled to have a partner with the technical knowledge, mandate, and tools to do that.
  • Flexibility about form structure and questions — I initially thought there would be a strong demand for submissions that look exactly like current paper forms. That hasn’t been the case. In all but one or two cases, I was not only able to move forms online, but also suggest changes that made forms shorter, more clear, and more accessible.
  • Excited about future change — Early on I began to notice a pattern. A few weeks after I moved a form online, some departments would to reach back out and ask for tools to help them manage digital submission, “This has been absolutely amazing. It would be great if I could approve it and then send it to Steve for his signature”. I thought a lot about the phrase salami slicing. If I tried to change everything about the way these departments worked right off the bat, they would have resisted every step of the way. Moving just a part of their workflow online made them eager to go completely digital.

This is close to home as my company is right now engaged in an effort to do this sort of thing for the U.S. Military Enrollment Processing Command. It's not easy.

The plan

Today I plan to take Parker on a decent walk before it gets cold and starts snowing. I'm also working on a couple of minor updates to Weather Now, including looking into creating an API against which I can write a React/Relay front-end.

Also I have a lot of reading to catch up on, some of which I may write about.

In other words: a quiet Saturday at home.

Why I hate the suburbs

I spent over 3 hours in my car today in principal because there were no public transit options to my remote, suburban destination. That, plus all-day meetings, means that instead of outlining what I'm planning for the weekend—I'll do that tomorrow—I'm just going to line up some articles I want to read:

I now have to pack. Parker will be unhappy with this.

Happy 2018, UTC!

It's now just past what computer people call "2018-01-01T00:00:00" (or, in more human-readable form, "2018-01-01 00:00:00 +00:00").

Some of you will remember that 2017 was exactly 1 day and 1 second shorter than 2016, owing to the leap second added a year ago at 2017-12-31T23:59:60.

Even thought 2017 was that much shorter than 2016, it seemed so much worse. But that's literally behind us now (or at least in the 13/24ths of the world on GMT or ahead of it). Here's looking to 2018 to be just a tiny bit better.

Happy new year!

My project in the news

The Washington Post is reporting tonight something that I've known for several weeks. My current project's customer, USMEPCOM, recently promulgated a directive to begin accepting transgender applicants into the U.S. armed forces:

The military distributed its guidance throughout the force Dec. 8. Lawyers challenging President Trump’s proposed ban on transgender military service, which he announced on Twitter in July, have since included the document in their lawsuits. The memorandum states the Pentagon will comply with federal court orders, now under appeal, that direct the military to begin accepting transgender recruits Jan. 1.

The policy paper was issued by the U.S. Military Entrance Processing Command in Chicago, “and shall remain in effect until expressly revoked,” the memorandum said. It states that allowing transgender military service is “mandatory” and repeats a previous directive from Marine Gen. Joseph F. Dunford Jr., the chairman of the Joint Chiefs of Staff, who has said all people will be “treated with dignity and respect.”

Military recruiting personnel are responsible for inputting into databases recruits’ personal information. They should do so while using a copy of a recruit’s birth certificate, court order or U.S. passport “reflecting preferred gender,” according to the Pentagon’s new guidance.

“For the purposes of military entrance processing, the applicant’s preferred gender will be used on all forms asking for the ‘sex’ of an applicant,” the guidance said.

So, it turns out, we're writing the database mentioned in the article. In fact, our Scrum board has this story: "As a user, I can enter the preferred gender of a applicant, so that I can enroll them into the military." And the USMEPCOM directive from December 8th is attached to the card.

Months of policy disputes between the President and the Federal courts, news articles, marches, protests, lawsuits, and committee meetings has produced...one database field.

This is our crazy country right now.

If you're curious, here's the policy memo. Don't worry, you can read it: it's unclassified.

Blah day

I'm under the weather today, probably owing to the two Messiah performances this weekend and all of Parker's troubles. So even though I'm taking it easy, I still have a queue of things to read:

I will now...nap.