Article – Bob Thompson http://www.drbob.17after.com My musings Thu, 26 Jul 2018 12:02:13 +0000 en-US hourly 1 https://wordpress.org/?v=7.0 C# 8 Ranges and Recursive Patterns http://www.drbob.17after.com/2018/07/26/c-8-ranges-and-recursive-patterns/ Thu, 26 Jul 2018 12:02:13 +0000 http://www.drbob.17after.com/?p=1119 Source: InfoQ

This article discusses two features proposed for C# 8: Ranges and Recursive Patterns. Both of these belong to the category of Code Simplification. The article explains these in detail with many examples and how these features can help you to write better code.

Key Takeaways

  • C# 8 Adds Ranges and Recursive Patterns
  • Ranges easily define a sequence of data, replacing the Enumberable.Range()
  • Recursive Patterns brings an F#-like construct to C#
  • Recursive Patterns is an awesome feature, it giving you the flexibility to testing the data against a sequence of conditions and performing further computations based on the condition met.
  • Ranges is very useful to generate sequences of numbers in the form of a collection or a list.

Ranges easily define a sequence of data. It is a replacement for Enumerable.Range() except it defines the start and stop points rather than start and count and it helps you to write more readable code.

Recursive Patterns matching is a very powerful feature, which allows code to be written more elegantly, mainly when used together with recursion. The Recursive Patterns consists of multiple sub-patterns like as Positional Patterns, e.g.,var isBassam = user is Employee ("Bassam",_), Property Patterns, e.g.,p is Employee {Name is "Mais"}, Var Pattern, Discard Pattern (‘_’),and so forth.

 

Read the entire article at InfoQ.

]]>
Pyramid of Capitalist System http://www.drbob.17after.com/2018/06/20/pyramid-of-capitalist-system/ Wed, 20 Jun 2018 11:35:28 +0000 http://www.drbob.17after.com/?p=1033 Source: Futility Closet

“Pyramid of Capitalist System,” from a 1911 edition of Industrial Worker, a newspaper of the international labor union Industrial Workers of the World.

The inherent vice of capitalism is the unequal sharing of blessings. The inherent virtue of socialism is the equal sharing of miseries. ~ Churchill

]]>
An Early Look at .NET 4.8 http://www.drbob.17after.com/2018/06/18/an-early-look-at-net-4-8/ Mon, 18 Jun 2018 11:36:16 +0000 http://www.drbob.17after.com/?p=1019 Source: https://www.infoq.com/news/2018/06/.Net-4.8-Preview by Jonathan Allen

While most of the attention is on .NET Core, work continues on the classic .NET Framework. An “early access” preview of .NET 4.8 shows the areas that Microsoft is most concerned about including high graphics Dots per Inch (DPI), accessibility, and concurrency.

.NET 4.8 is expected to be released in 2019. The current expectation is that it will run on Windows 10 build 1607 at later, but that decision isn’t final.

Span<T>

Before we get into what is included, it should be noted that the most requested feature, Span<T>, is not going to be part of this release. According to Rich Lander of Microsoft,

Span is included in .NET Core 2.1. We explored including Span in .NET Framework 4.8 and decided against it due to compatibility concerns for existing applications. You can get access to Span and additional related types in the System.Memory Nuget package which enables some of the scenarios that are enabled on .NET Core. System.Memory: https://www.nuget.org/packages/System.Memory/

High DPI

High DPI continues to be a focus for .NET. As monitor resolutions continue to improve, applications need to be scaled up to compensate lest the text and images are too small to be legible. In this release, ClickOnce and WinForms are receiving high DPI updates.

There are a couple reasons why high DPI issues keep occurring. First is the availability of high resolution monitors. Microsoft couldn’t effectively test scaling at 200 and 300% until hardware that needed that amount of scaling became available. So until monitors stop improving, scaling will continue to be a problem.

Another challenge is multi-monitor setups. When an application moves between monitors with different resolutions, the scaling has to be recalculated and images swapped out. Even worse, an application can overlap two or more monitors with different resolutions. Various compromises are necessary to address this situation and the results aren’t always satisfying.

Performance

In addition to the usually internal tweaking such as reducing memory usage for AsyncLocal or fine-tuning spin locks, this release fixes an issue where SqlDataReader.ReadAsync wasn’t actually being performed asynchronously.

Deadlocks and Race Conditions

Given the maturity of the .NET Framework, it may come as a surprise to learn that many of the core libraries still harbor race conditions and dead locks. Here is a partial list of concurrency-related issues.

    • CLR: potential crash with concurrent calls to a new dynamic method
    • CLR: possible deadlock when calling Dispose() on an EventSource
    • Networking: NetworkInformation.NetworkChange deadlock scenario when there is a lock around NetworkChanged listener and user’s callback
    • WCF: race-condition that exists in AsyncResult that closes a WaitHandle before Set() is called
    • WCF: race-condition when aborting connections which caused ObjectDisposedException to be thrown in CleanupChannelCollections
    • Workflow: under extreme usage conditions (high volume of connections to MSDTC), it was possible for a CriticalSection to be held by a single thread indefinitely
    • User Interface Accessibility (UIA)

UIA concerns continue to be a priority with WinForms gaining new UIA behaviors and UIA bugs being fixed in both it and WPF. (Many non-UIA bugs were also fixed in both.)

For a full list of changes, see the .NET 4.8 release notes. The preview build itself is available via the .NET Blog.

]]>
Optimize Alertness With Caffeine During Sleep Loss http://www.drbob.17after.com/2018/06/12/optimize-alertness-with-caffeine-during-sleep-loss/ Wed, 13 Jun 2018 00:03:56 +0000 http://www.drbob.17after.com/?p=1015 ]]> 7 Words that Make You Sound Passive Aggressive at Work http://www.drbob.17after.com/2018/05/24/7-words-that-make-you-sound-passive-aggressive-at-work/ Thu, 24 May 2018 12:49:17 +0000 http://www.drbob.17after.com/?p=986 According to an article in  FairyGodBoss, you should not use the following stereotypical passive-aggressive words when interacting with people at work:

  1. “Fine”
  2. “Thanks in advance”
  3. “Per my last email”
  4. “In case you missed it …”
  5. “Sure”
  6. “I thought you knew”
  7. “I hope you don’t mind”

Avoiding these seven phrases can help to eliminate all hostility in the workplace while also improving relationships you have with your peers, and help you avoid unnecessary and unproductive tension in the office.

Read the entire article on why you should avoid these phrases at FairyGodBoss

 

]]>
Technique Ambitious People Use To Get What They Want http://www.drbob.17after.com/2018/05/22/technique-ambitious-people-use-to-get-what-they-want/ Tue, 22 May 2018 12:05:07 +0000 http://www.drbob.17after.com/?p=981 There is the type who expects to be asked a number of questions from management. And then there is the type who expects not only to do most of the asking, but to put on a presentation. It is the first type that sees the situation as an interview, and it is the second who sees it not as an interview, but as an audition.

This is a great article and you can read the rest of it at Ryan Holiday “Meditations on Strategy and Life”.

]]>
San Franciscans need to earn $333,000 a year to buy a median-priced home http://www.drbob.17after.com/2018/05/17/san-franciscans-need-to-earn-333000-a-year-to-buy-a-median-priced-home/ Thu, 17 May 2018 21:49:57 +0000 http://www.drbob.17after.com/?p=975 A Bay Area household would have needed at least $186,300 in annual income to make the $4,660 monthly payment on a $900,000 home, with mortgage rates at 4.44 percent according to a study by the California Association of Realtors. The association figured that 23 percent of Bay Area households earned at least that much, but affordability varied widely by county. In San Francisco and San Mateo counties, only 15 percent of households could afford a median-priced home, which averaged $1,610,000 and $1,575,050, respectively, during the first quarter.

Read the article and find out about the other results from the study at SFChronicle.com.

 

]]>
10 Deep Breaths that Will Change Your Attitude (When You Can’t Change What Happened) http://www.drbob.17after.com/2018/05/03/10-deep-breaths-that-will-change-your-attitude-when-you-cant-change-what-happened/ Thu, 03 May 2018 12:51:09 +0000 http://www.drbob.17after.com/?p=934 This morning’s email from Marc and Angel’s had this excellent suggestion that I wanted to share.

“How can I respond from a place of clarity and strength, rather than continuing to react in anger and frustration to the painful experience I was forced to live through?”

Every time you are tempted to react in the same old way, pause, and consciously decide if you want to be a prisoner of the past or a pioneer of the present moment.

In order to gain conscious control of what’s really going on in your mind, you need to develop a keen awareness for this process. What helps is to hold still for a moment, take a ten deep breaths, focus exclusively on these breaths, and free your mind of the senseless chatter that’s going on inside your head. This makes room for a change of state, for something new to enter.

Detached from the weight of stressful thoughts and reactions you grow capable of consciously redirecting your focus. It’s time to take it willingly away from something unchangeable that drags you down, and zero it in on something actionable that inspires you. Focus on the next logical, meaningful step. Remind yourself that there are no hopeless situations; there are only people who have grown hopeless about them.

In almost every case, nothing is stopping you right now—nothing is holding you back but your own thoughts about yourself and “how life is.”

You may not be responsible for everything that happened to you in the past, or everything that’s happening to you right now, but you need to be responsible for undoing the thinking patterns these circumstance create.

It’s about thinking better so you can ultimately live better.

The key is to understand that no matter what happens, you can choose your response, which dictates pretty much everything that happens next. Truly, the greatest weapon you have against anxiety, negativity and stress is your ability to choose one present thought over another—to train your mind to make the best of what you’ve got in front of you, even when it’s far less than you expected.

Yes, YOU CAN change the way you think! And once you do, you can master a new way to be.

Be sure to visit  Marc and Angel’s web site for more excellent material and resources. They are great!

]]>
Gmail’s Drag and Drop (20480) http://www.drbob.17after.com/2018/03/23/gmails-drag-and-drop/ Fri, 23 Mar 2018 13:45:51 +0000 http://www.drbob.17after.com/?p=903 An older article describing how Gmail handles file drag and drop to create email attachments.

How Gmail’s drag and drop works and why it’s not supported in Safari

]]>
Nova Scotia Bans Cat Declawing http://www.drbob.17after.com/2018/03/17/nova-scotia-bans-cat-declawing/ Sat, 17 Mar 2018 11:17:26 +0000 http://www.drbob.17after.com/?p=882 It’s about time this becomes a law everywhere. I hope other provinces, states, and nations follow suit. The procedure has been equated with amputating the top of a human finger which is a horrible thing to think of. The practice has already been banned in the U.K., Europe, Australia and several California cities, but it needs to be more widespread.

You can read the CBC News article here.

]]>