Testing A New Web Server Without DNS Changes

When migrating to a new server, it’s good to validate site functionality before redirecting users to the new host. i.e. I have anya.rushworth.us set up in the httpd config on both server1 and server2. DNS currently points traffic to server1, but I need to test the site on server2.

Approach #1 – With administrative access to the host

Edit your hosts file – open an administrative command prompt

Edit %SYSTEMROOT%\system32\drivers\etc\hosts and add lines with the IP address WHITESPACE and the hostname(s). E.G.
127.0.0.1 lisatest lisatest.rushworth.us lisatest2 lisatest2.rushworth.us
10.1.2.3 otherhost otherhost.rushworth.us
10.2.3.4 anya anya.rushworth.us

Clear your DNS cache (ipconfig /flushdns) and navigate to the URL. You’ll be directed the IP address from your hosts file instead of the DNS registered address.

Approach #2 – No admin access

Install ModHeader in your Chrome browser and click the extension to modify the headers or install ModHeader in your Firefox browser. Click on the extension icon to set a header value.

Add a “Host” header with the value of the virtual host name you need to test

Navigate to the hostname of the new server – https://server2.rushworth.us – but the web server will receive the Host header you configured in ModHeader and serve the web site based on that host header.

 

Creamy Corn Chowder

Creamy Corn Chowder

Recipe by LisaCourse: Dinner, SoupsCuisine: AmericanDifficulty: Easy
Servings

4

servings
Prep time

30

minutes
Cooking time

40

minutes

Ingredients

  • 2 Tbsp butter

  • 1 medium onion, chopped

  • 2 cloves garlic, minced

  • 5 ears fresh corn, kernels cut from cobs

  • 6 cups stock (veggie, chicken)

  • 1 lb potatoes, diced

  • 2 tbsp corn starch

  • Bacon (or veggie bacon)

  • Cheddar cheese

Method

  • Melt the butter in a stock pot and saute onions until translucent.
  • Add garlic and saute until fragrant
  • Add corn kernels and saute until they start to caramelize
  • Add stock, corn cobs, and potatoes. Simmer for 30 minutes.
  • Mix cornstarch with a little water to form non-Newtonian fluid. Slowly mix into soup to thicken broth.
  • Near the end of cooking time, saute bacon.
  • Ladle soup into bowls. Sprinkle with cheddar cheese and bacon.

Exporting A Microsoft Teams Chat

There’s no export functionality in MS Teams chats and conversations. From Microsoft’s standpoint, this makes sense — customer retention. From the customer standpoint, however? There are times I really want to transfer a conversation elsewhere for some reason. You can copy/paste individual text bubbles. If you only need to get one or two bubbles, manually copying the text is going to be quicker. And, for those with special access, there’s the Security & Compliance discovery export stuff as well as an approach using the Graph API. But for the rest of us general users, there’s no easy way to export the bunch of little chat bubbles that comprise a MS Teams chat.  There is, however, a not-too-hard way to do it in the Teams web client.

I’ll prefix these instructions with a disclaimer – your company may have document retention in Teams. When you export your chat content, you’ll need to maintain appropriate retention policies yourself. In IT, we had a few information categories where retention was “useful life” – we could retain system documentation as long as the system was used. If you’re exporting a chat to keep something you are allowed to keep and then keep it outside of Teams … that’s awesome. If you are trying to keep something the company’s retention policy says should be removed … that’s probably not awesome.

Once you’ve determined that the info you are exporting is OK to export and maintain elsewhere, here’s how to export a Teams chat from within the Teams web client. Step 1, of course, is to lot into Teams at https://teams.microsoft.com and go to the chat you want to export. Scroll up to the top of the chat. If you have a really long chat, it may not be possible to export the entire thing using this approach. I might play around with it in the future, by most of my conversations are in Teams channels so I don’t have a chat that’s more than 30 or so messages.

Once you are at the top of the chat, open the developer tools (ctrl-shift-i in Chrome). Clear the errors — they clutter up the screen.

Paste the following script into the console and hit enter:

var strRunningText = "";
var collectionMessageBubbles = document.querySelectorAll('.message-body-content, .message-datetime');

for (let objMessageBubble of collectionMessageBubbles) {
     strRunningText = strRunningText + "\n" + objMessageBubble.textContent;
}

console.log(strRunningText);

If you have a long series of chat messages, you’ll get some of the chat displayed and a button to copy the entire chat content to your clipboard.

If you have a shorter series of chat messages, you’ll have the text of the chat in the console window. You can highlight it and copy/paste the text elsewhere.

There’s a little cleanup that can be done – the content of the message-datetime elements have a beginning and trailing newline character along with a bunch of whitespace. You can get a cleaner timestamp (but, if you embed code within your messages … which I do … the code sections have a lot of extraneous newlines):

var strRunningText = "";
var collectionMessageBubbles = document.querySelectorAll('.message-body-content, .message-datetime');

for (let objMessageBubble of collectionMessageBubbles) {
     strRunningText = strRunningText + "\n" + objMessageBubble.innerText;
}

console.log(strRunningText);

The same JavaScript works in the Teams channel conversations except the channel conversations tend to be longer … so you’re going to export some subset of the channel conversation around where you are in the web browser.

* I realized, during a multi-person chat last week, that I don’t grab the name of the individual who posted the message to the chat. Grabbing the person’s name should just entail adding the identifier for the name element into the querySelectorAll list … but that’s not something I’ve had an opportunity to check yet.

Dynamically determining AD Page Size

Question — is it possible to dynamically determine the maximum page size when communicating with AD via LDAP? Since the page size (1) changed between versions and (2) can be user-customized … a guess is sub-optimal.

Answer — yes. If only the default query policy is used, search at
CN=Default Query Policy,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,*domain naming context* (e.g.
CN=Default Query Policy,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,DC=example,DC=com) with a filter like “(&(cn=*))”

Return the ldapAdminLimits attribute. Parse MaxPageSize out of the attribute:

lDAPAdminLimits (13): MaxValRange=1500; MaxReceiveBuffer=10485760; MaxDatagramRecv=4096; MaxPoolThreads=4; MaxResultSetSize=262144; MaxTempTableSize=10000; MaxQueryDuration=120; **MaxPageSize=1000**; MaxNotificationPerConn=5; MaxActiveQueries=20; MaxConnIdleTime=900; InitRecvTimeout=120; MaxConnections=5000;

To find all of the query policies, search at CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,CN=Configuration,*domain naming context* for (&(objectClass=queryPolicy)) … either research a lot about query policies and figure out how to determine which applies to your connection or take the lowest value and know you’re safe.

Minority Rule

‘Having more Reps than any other state’ does not mean “the population is equitably represented”. The number of people represented by those Representatives (or electoral college delegates, for that matter)? Each House member represents ~702k Californians. Each electoral delegate represents ~677k Californians.
Congressional apportionment isn’t fractional, so there’s over- and under- representation — the distribution just advantages different states. Rhode Island had just over a million people in the 2010 census but have two reps — each of those individuals represent some 500k Rhode Islanders. There are states that fair worse in the HoR — Montana had just under a million and have one rep.
Taking the American government as a whole — low-population density states are over-represented in the Senate and Electoral College — which also means they are over-represented in SCOTUS. Asserting “the majority have a chance to win one half of the Legislature … a chance to create an impasse where nothing gets done” isn’t the most functional form of government imaginable. I understand and appreciate the “minority rights” idea behind over-representation. And, obviously, those in the minority will view the situation differently. But there’s a difference between the minority having enough power to force compromises toward their position and minority rule with … well, seemingly “fuck you”. Or minority rule with a majority who are able to prevent legislative changes (leading to the prevalence of Executive Orders).

 

Number of people represented by each rep in the Senate:

This is where I’d know small populations are over-represented. Two senators regardless of population — a state with a hundred residents would have two senators. Obviously we don’t have a state with a hundred residents — but the least populous states are the ‘best deal for residents’ list — lowest number of people represented by each Senator

Size Rank State 2010 Population per Census Senators # Represented per Senator
52  Wyoming 563,626 2                                     281,813.0
50  Vermont 625,741 2                                     312,870.5
49  North Dakota 672,591 2                                     336,295.5
48  Alaska 710,231 2                                     355,115.5
47  South Dakota 814,180 2                                     407,090.0
46  Delaware 897,934 2                                     448,967.0
45  Montana 989,415 2                                     494,707.5
44  Rhode Island 1,052,567 2                                     526,283.5
43  New Hampshire 1,316,470 2                                     658,235.0
42  Maine 1,328,361 2                                     664,180.5

And the most populous sates are the ‘worst deal for residents’ list — highest number of people represented by  each Senator

Size Rank State 2010 Population per Census Senators # Represented per Senator
1  California 37,253,956 2                               18,626,978.0
2  Texas 25,145,561 2                               12,572,780.5
3  New York 19,378,102 2                                  9,689,051.0
4  Florida 18,801,310 2                                  9,400,655.0
5  Illinois 12,830,632 2                                  6,415,316.0
6  Pennsylvania 12,702,379 2                                  6,351,189.5
7  Ohio 11,536,504 2                                  5,768,252.0
8  Michigan 9,883,640 2                                  4,941,820.0
9  Georgia 9,687,653 2                                  4,843,826.5
10  North Carolina 9,535,483 2                                  4,767,741.5

 

Number of people represented by each rep in the House of Representatives:

But the apportionment in the House of Representatives isn’t as equitable as one might assume. It’s a different list of states under- and over- represented … but one rep from Rhode Island represents half a million people. One rep from Montana represents just short of a million people!

Best deal for residents — small number of people represented by each rep

Size Rank State 2010 Population per Census Reps # Represented per Rep
44  Rhode Island 1,052,567 2                             526,283.5
52  Wyoming 563,626 1                             563,626.0
39  Nebraska 1,826,341 3                             608,780.3
38  West Virginia 1,852,994 3                             617,664.7
50  Vermont 625,741 1                             625,741.0
43  New Hampshire 1,316,470 2                             658,235.0
24  South Carolina 4,625,364 7                             660,766.3
21  Minnesota 5,303,925 8                             662,990.6
42  Maine 1,328,361 2                             664,180.5
13  Washington 6,724,540 10                             672,454.0

Worst deal for residents — high number of people represented by each rep:

Size Rank State 2010 Population per Census Reps # Represented per Rep
45  Montana 989,415 1                           989,415.00
46  Delaware 897,934 1                           897,934.00
47  South Dakota 814,180 1                           814,180.00
40  Idaho 1,567,582 2                           783,791.00
27  Oregon 3,831,074 5                           766,214.80
31  Iowa 3,046,355 4                           761,588.75
25  Louisiana 4,533,372 6                           755,562.00
28  Oklahoma 3,751,351 5                           750,270.20
18  Missouri 5,988,927 8                           748,615.88
32  Mississippi 2,967,297 4                           741,824.25

 

Electoral College:

The combination of which yields the over and under representation in the Electoral College (and the reason I think the National Popular Vote Interstate Compact is such a good idea).

Best deal:

Size Rank State 2010 Population per Census Electoral Delegates # Represented per Delegate
52  Wyoming 563,626 3 187,875
51  District of Columbia 601,723 3 200,574
50  Vermont 625,741 3 208,580
49  North Dakota 672,591 3 224,197
48  Alaska 710,231 3 236,744
44  Rhode Island 1,052,567 4 263,142
47  South Dakota 814,180 3 271,393
46  Delaware 897,934 3 299,311
43  New Hampshire 1,316,470 4 329,118
45  Montana 989,415 3 329,805

And the worst deal

Size Rank State 2010 Population per Census Electoral Delegates # Represented per Delegate
1  California 37,253,956 55 677,345
3  New York 19,378,102 29 668,210
2  Texas 25,145,561 38 661,725
4  Florida 18,801,310 29 648,321
5  Illinois 12,830,632 20 641,532
7  Ohio 11,536,504 18 640,917
10  North Carolina 9,535,483 15 635,699
6  Pennsylvania 12,702,379 20 635,119
11  New Jersey 8,791,894 14 627,992
8  Michigan 9,883,640 16 617,728

Divide by Zero Error

None of which speak to the almost five million people who are unrepresented in the Legislature. Or the just short of one million people who aren’t even represented in the Electoral College.

Size Rank State 2010 Population per Census Reps # Represented per Rep Senators # Represented per Senator Electoral Delegates # Represented per Delegate
29  Puerto Rico 3,725,789 0 #DIV/0! 0 #DIV/0! 0 #DIV/0!
51  District of Columbia 601,723 0 #DIV/0! 0 #DIV/0! 3 200,574
53  Guam 159,358 0 #DIV/0! 0 #DIV/0! 0 #DIV/0!
54  U.S. Virgin Islands 106,405 0 #DIV/0! 0 #DIV/0! 0 #DIV/0!
56  Northern Mariana Islands 53,883 0 #DIV/0! 0 #DIV/0! 0 #DIV/0!
55  American Samoa 55,519 0 #DIV/0! 0 #DIV/0! 0 #DIV/0!

 

And the spreadsheet, in case it’s useful to someone else.