C For Fun

Old but gold…

/*
* find the important things in Life, the Universe, and Everything
*/

typedef short some; /* some things are short */
typedef some very; /* some things are very short */

#define A /* The first letter of the English Alphabet */
#define LINE 2 /* 2 points define a line */

#define TRUTH BEAUTY /* truth is beauty */
#define BEAUTY 10 /* and beauty is a 10 */

#define bad char /* burnt on both sides */
#define old char /* the great Chicago Fire */

#define get strlen /* during your life, try to get some sterling */
#define youmake float /* you make it, I’ll drink it */

Continue reading
Posted in C, Essentials | Tagged | Comments Off on C For Fun

Jon Galloway on Visual Studio Mac

Jon joins us again, this time to talk about Visual Studio Mac and Maui!

Posted in Essentials, Mac, Maui, Visual Studio | Tagged | Comments Off on Jon Galloway on Visual Studio Mac

Xamarin Best Practices

In a recent blog post, I showed the C# best practices we use at my current placement. Today, the Xamarin best practices:

Xamarin 🐒 Best Practices

The Do’s 🙌

👍 Catch XAML Errors Early

Add the following attribute to code behind in order to improve performance and catch xaml errors early.

[assembly: XamlCompilation (XamlCompilationOptions.Compile)]

Why: https://stackoverflow.com/questions/46338575/bad-xaml-still-compiles-with-no-error-then-runtime-error-occurs-in-xamarin-form/46338664 

Continue reading
Posted in Essentials | Comments Off on Xamarin Best Practices

C# Coding Standards – Updated

Let’s face it, most coding standards are arbitrary. The key to a successful project, however, is not which standards you follow, but that you are consistent.

Here is a partial list of the C# coding standards my team uses and advocates, updated by what we’ve learned in the past year.

Most of these are industry-wide conventions and thus using them will ensure that your code is easily readable by people who are not you. (Many thanks to Adam for letting me post this here)

👍 use PascalCasing for class names and method names.

public class ClientActivity 
{ 
    public void ClearStatistics() 
    { 
        //... 
    } 

    public void CalculateStatistics() 
    { 
        //... 
    } 
} 

Why: consistent with the Microsoft’s .NET Framework and easy to read.

👍 use camelCasing for method arguments and local variables.

public class UserLog 
{ 
   public void Add(LogEvent logEvent) 
   { 
    var itemCount = logEvent.Items.Count; 

    // ... 
   } 
} 

Why: consistent with the Microsoft’s .NET Framework and easy to read.

Continue reading
Posted in C#, C# 8, C# 9 | Comments Off on C# Coding Standards – Updated

Mads Torgersen! C# 9 & Beyond

Microsoft’s Mads Torgersen– Lead Designer of C# — talks about how to know when to use the new features in C# 8 and 9, and more.

Photo credit: Jesse Liberty

Posted in C#, C# 9, Essentials | Tagged | Comments Off on Mads Torgersen! C# 9 & Beyond

Covid, False Positives & Bayesian Probability

This is a repost from 2009. It talks about breast cancer, but applies equally well to Covid testing, given the high percentage of false positives (not to mention the more worrisome false negatives). We simply are not wired well for probability…

Yudkowsky poses the following canonical problem:

1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammographies. 9.6% of women without breast cancer will also get positive mammographies.

Continue reading
Posted in Essentials | Comments Off on Covid, False Positives & Bayesian Probability

New site for my writing

I’ve created a site for my non-technical writing. Check it out.

Posted in Essentials | Comments Off on New site for my writing

.NET Maui!!!

Check out this lineup of guests

What can I say… an hour of amazing Maui goodness, including:

  • What is Maui?
  • When is Maui?
  • How does it affect Xamarin.Forms?

Posted in Maui, Xamarin.Forms | Tagged | Comments Off on .NET Maui!!!

MonkeyCache step by step

The amazing James Montemagno of Xamarin/Microsoft has done it again. He has created an incredibly simple cache, named MonkeyCache, that you can get up and running very quickly.

In this post I will walk through setting up and using the cache, step by step.

Continue reading
Posted in Essentials | Tagged , | Comments Off on MonkeyCache step by step

DataTemplateSelector

Suppose you have a collection of items and you want to display them in a ListView (Xamarin.Forms). The catch is that you want to change the display of each item depending on its state or some other code-based attributes.

At first glance this would seem very difficult, and you’d have to modify the instances in the collection to do so. This is where the DataTemplateSelector comes in.

In short, you create two or more data templates — one for each way you might want to display one of the items in your collection — and then you tell Xamarin.Forms, by way of the DataTemplateSelector, which data template to use.

Continue reading
Posted in Essentials, Xamarin.Forms | Comments Off on DataTemplateSelector

Jon Galloway: VS Mac & More

Jon Galloway. Friend of the show, PM on Visual Studio Mac, amazing guy.

Links:https://visualstudio.microsoft.com/vs/mac/
https://dotnet.microsoft.com/platform/community/standup
https://twitch.tv/jongalloway
https://github.com/SteveSandersonMS/CarChecker

Posted in Mac, Visual Studio, Xamarin.Forms | Tagged | Comments Off on Jon Galloway: VS Mac & More

C# 9 Part 3 – Patterns

Jared Parsons – lead of the C# Compiler Team at Microsoft

Posted in C#, Essentials | Tagged | Comments Off on C# 9 Part 3 – Patterns