It's 5:48 am. Our friendly host told us last night that we'd wake up at 4:00 am due to jet lag. Obviously he doesn't know what he is taking about, 4:00 am was almost two hours ago. I'll correct him in the morning.
Oops, that's sarcasm. Sarcasm is one of those things that usually doesn't translate. I need to learn how communicate here so I better choose my words carefully. Either that or I can use this blog as an outlet for any of my sarcasm.
Obviously Becky and I have arrived safe and sound. Right now, as I slowly swipe this blog entry into my cell phone with my thumb, Becky is tucked into bed probably not sleeping either. I'm in the living room sitting on the leather couch wearing only jeans. ...Just now I was curious if my back would stick to the couch, it's so dry here that I thought it might not, but it did. Also, don't worry Mom, I'm drinking plenty of liquids.
It's hard to articulate my first impressions of China. It's cold, dry, flat, brown, smells like smoke, and is covered in a thin layer of useless dry powdery snow. (Snow that cannot be built into igloos or snow men is useless. Also it's flat here, so no snow boarding) There are about ten million people in this area so there are plenty of tallish buildings. The road near where we are staying is 14 lanes wide, 7 lanes going one way, and seven going the other way, these lanes are completely ignored but traffic flows. Drivers in China like honking their horns outside our bedroom window while ignoring these lanes.
The locals here are very friendly and I haven't seen any other foreigners yet.
Oh, and a fun detail, from Becky, is that fruit here is sold frozen on the streets using the great outdoors as the freezer. Ice cream bars are also sold as street food from cardboard boxes out on the open.
Well the city is starting to wake up and honk at each other, maybe I'll try to sleep some more.
Monday, November 30, 2015
Day 1 - Freeze Dried
Day Zero Leg 2
Ok, now we're on the plane again, somewhere over China, about two hours left. Becky is playing her favorite word search game on her tablet. "Ricky and the Flash" is playing silently with Chinese subtitles on the little screen hanging down from the ceiling 3 rows up, it looks like Meryl Streep's character has just gotten to know her grown daughter, which she apparently abandonned and left with the father, but is hitting the road again. We lucked out on this flight, we have an entire row to ourselves, and the row in front of us, half the row in front of that, half a row behind us, you get the idea. It's leg room heaven! In a few hours we'll be talking to immigration officials, handing them the little yellow forms we just filled out on the plane. I'm wondering how it will go. I've had a few language-barrier frustrated conversations with immigration officials before about this box or that box on their forms... or at least that's what I thought the conversations were about. I saw something I've never seen before today. I saw a flight attendant attach an aluminum baby cot to the wall in front of the first row. The baby cot had straps and a little pillow and it was attached to the wall a little below eye level of the parents sitting in front of it. It's probably not a Chinese thing, or Tawainese, since this is an Airbus A321-200 and the wall has sockets for it built in, but I've never seen it before. There's not that much else that's interesting that I saw today. Although I was reminded of the Taiwanese custom of having women clean the men's bathrooms while the men are using it. It happened to me pretty often when I lived in Tawain in 2008. At first it was confusing, then akward, then kind of insulting for some reason, then I hardly noticed. And now, seven years later, it's just like old times. I wonder what new customs I will adapt to next. Well this blog entry is getting longish and I can't remember much else that I've noticed so far. I will say one thing, the Chinese food on EVA, a Taiwan based airline, is pretty good, whereas the American style food is about the same as it is on an American airline: not as good as the Chinese food on EVA. Also, note to future self: bring an extra shirt in the carry-on for your next long flight. My green extra largeXbox T-Shirt has EVA Chinese food stains and Taiwanese Niu rou mian (Beef noodle soup) stains all over it. Meryl Streep's character is singing with her band at her daughter's friend's wedding, and her daughter is laughing, it seems that her attempts to form a relationship with her daughter were a success. Oh now her daughter is singing with her. Now I can end this blog entry.
Sunday, November 29, 2015
Day Zero
Wednesday, August 12, 2015
ILSpy for Decompiling Assemblies
Although ILDASM helped me find source code from a hexadecimal location in an error message from production, I'm not sure if you can do that with ILSpy, I haven't tried.
It's an open source project called ILSpy, this is their website: www.ilspy.net
Thursday, June 04, 2015
Too many parameters in my constructors.
Quotes from this article: http://blog.ploeh.dk/2010/02/02/RefactoringtoAggregateServices/
"Surely, five constructor parameters are too many."
"Constructor Injection makes SRP violations glaringly obvious."
If you think that I should use a dependency injection framework, I disagree.
I agree with this article: http://blog.schauderhaft.de/2012/01/01/the-one-correct-way-to-do-dependency-injection/
You can use it in your outer layers to get things built up and started, but don't call a dependency injection framework from your business logic, your inner layers. All of your injected dependencies should be injected into the constructors so they will be obvious, not scattered throughout your code.
Thursday, May 07, 2015
Variable Swap Problem
[TestMethod]
public void NoExtraVariables_Swap_XY()
{
int x = 6;
int y = 248;
x ^= y;
y ^= x;
x ^= y;
Assert.AreEqual(248, x);
Assert.AreEqual(6, y);
}
Thursday, September 18, 2014
How To Use IL Disassembler (ILDASM)
After you've built and deployed an ASP.NET or ASP.NET MVC web application to an IIS web server and then it throws an exception, but the exception doesn't have any line numbers referring to your source code, how do you find where the error is?
I had such an exception message, it was telling me that "a reference wasn't set to the instance of an object." But of course it wasn't telling me which 'reference' it was referring to, but it did tell me the module, the method name, and it had a little plus sign and a number (like this +248) after the method name.
This number is a 'memory (byte) offset.' It tells you which binary instruction, or which byte, inside the method is throwing an exception. In my case the method had several lambda expressions, so the source code line number, not just the name of the method, would be useful to me to fix the problem.
I searched online for a way to figure out precisely where in my code that the +248 memory offset pointed to. I found out about a tool that was already included with Visual Studio 2010-2013 called ILDASM, or IL Disassember, and then I started figuring out how it worked and how to use it to find where my error was.
After an hour or so of playing with it I wondered why I had never used it before. So here are some 'quick and dirty' instructions on how to use ILDASM to find where an error is in your source code.
Step 1: Open ILDASM
- From the Windows Start Menu, open a Visual Studio Developer Command Prompt
- Type ildasm
- Press Enter.

Step 2: Find Your Project Folder & The Compiled DLL
- Build your project in Visual Studio.
- From ILDASM, click File
- Click Open
- Find your From my Visual Studio project folder. In the example my project folder is C:\Code\MinistryTools1\MapViewer.
- If your project built successfully the binary DLL files should be some where like the bin\Debug folder, sometimes it's different.
- Navigate through the tree representation of the module and find the class and method that is throwing the exception. You should recognize the structure of the assembly, it should match the structure of your project.
Step 3: Calculate The Offset Hex Equivalent
Calculate the byte offset from the exception message, that looks like +248,- Open Calculator
- Switch it to Programmers Mode
- Type the number in decimal
- Click the Hex radio button to convert it to hexadecimal.

Step 4: Find The Line Number From The Hex Offset
- In the menu, click View
- Select Show source lines
- Double clicked on the tree node that matches the method name throwing the exception.
- A disassembled version of your code should appear in a windows that looks like this:
- Find the hex numbered line that starts with IL_, example: IL_0013, this is the hex memory offset.
- Look above the IL_ line for the source code line number. The source code lines are prefixed by two forward slashes and a six digit line number like this: //000062
Now you can find the line in Visual Studio and try fixing it.
Also
I have also seen that sometimes there is a clause that starts with .line 123,133 which tells you what lines the following commands belong to. I haven't figured out why that's necessary yet.
Friday, August 15, 2014
Multi-Tasking
- A 15 minute nap can increase your IQ by ten points.
- The short term memory really only holds three of four things at a time.
- Watching TV, or YouTube, might be relaxing but doesn't stimulate the lower "Creative" areas of the brain.
- FAA flight controllers are required to take 15-30 minutes breaks every 45-60 minutes.
- Staring out the window stimulates the lower "Creative" areas of the brain. You can also take a (quiet) walk and not think about work.



