BingDebug

So I update my iOS apps on my iPhone this morning, and what do we have here…

If you fellers out there in Redmond need someone to help you get the reins on this iOS stuff, drop me a line.

BTW, Happy Human Rights Day. Sorry, I don’t feel like coming up with something better after the egg laid by the Steelers yesterday against Oakland.

C# .NET simple Async Await example from console application Main

I did a couple of posts a few years back about doing async/await in VB.NET, and now I had need of doing something similar with a C# .NET console application.

Here is what I put together to get it working. This is the contents of the main class for a C# .NET console application, but you should be able to adapt the code to whatever need you have.

using System;
using System.Net.Http;
using System.Threading.Tasks;
 
namespace SimpleAsync
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Simple async");
 
            try
            {
                LengthyAsyncTask().Wait();
            }
            catch (Exception ex)
            {
                Console.WriteLine("There was an exception: " + ex.ToString());
            }
 
            Console.WriteLine("Press enter to quit application...");
            Console.ReadLine();
        }
 
        static async Task LengthyAsyncTask()
        {
            var response = await GetWebPage("https://www.dosomethinghere.com");
            Console.WriteLine("Response: " + response);
            // do something here with the response
        }
 
        static async Task<string> GetWebPage(string url)
        {
            var client = new HttpClient();
            var response = await client.GetAsync(url);
            var responseString = await response.Content.ReadAsStringAsync();
            return responseString;
        }
    }
}

BTW, Happy Anniversary to The Wall and Thriller, both seminal works of artistry from music’s golden age, released this day in 1979 and 1982, respectively. Darkness falls across the land… And how can you eat your pudding when you haven’t eaten your meat?

App crashes on iOS Simulator without debugging

If your app in the iOS Simulator works when debugging with Xcode, but the very same app crashes if you try to launch it without debugging, check your app for a framework listed under Linked Frameworks and Libraries, but not listed under Embedded Binaries. Once the framework shows up in both places, deploy the app again by debugging with Xcode, and then stop the debugging and try to launch it again on the Simulator.

BTW, Happy Birthday to Randall Munroe, creator of the xkcd web comic.

Visual Studio 2017 launches to a black or invisible screen, part 2

It turns out that disabling the Intel and Nvidia drivers on my Windows notebook computer are not really sufficient to fix the issue when Visual Studio 2017 launches to a black or invisible screen, as by doing this, I lost the ability to connect an external monitor to the HDMI port on the computer. Super bummer.

A bit more digging through the interwebs led me to this answer to a question on Stack Overflow:

White screen while opening visual studio

Basically, I re-enabled the Intel and Nvidia display options, then opened the Nvidia Control Panel by right-clicking on the desktop, selected Manage 3D Settings and changed the Preferred graphics processor selection from Auto-select to High-performance NVIDIA processor. Now everything is back to working the way I would like it to.

BTW, there are no birthdays today worthy of mention (cough, cough), so Happy International Left Handers Day!

Visual Studio 2017 launches to a black or invisible screen

So I am working along on a .NET project in Visual Studio 2017 on my Windows 10 Pro laptop, and all of a sudden when I launch the application, I get either a black window where the IDE should be, or the window area is transparent and I just see a shadow of the window edge. Very frustrating, as it was working fine the day before.

Finally I tracked it down to some kind of problem with a display driver. My laptop came preloaded with Intel and Nvidia display drivers and control panels, so I went into the computer management and disabled both the Intel and Nvidia display adapters. After rebooting, my screen still works, and magically I can see Visual Studio when I fire it up. Sure, there are some negatives to this, such as not being able to change the display resolution of the laptop panel, as the only choice in the dropdown is the native resolution of the panel. But at least I am able to once again get stuff done.

BTW, Happy Birthday to Joe Satriani. I hope Joe and the band make a tour stop somewhere near central Ohio soon. I saw the G3 tour last year in Cleveland, but there wasn’t enough Joe.

LINQ to SQL DBML file shows up as XML code in Visual Studio Community 2017

I have a project from a few years ago that I am looking back into again, and while it builds just fine in Visual Studio Community 2017, when I open the DBML file, I get a big XML file instead of a nice design surface with the data tables.

The solution to this issue is to install the correct component to handle this type of file. To do this, you need to exit Visual Studio IDE and then launch the Visual Studio Installer. Once there, click Modify, click the Individual components tab at the top, scroll down to the Code tools section, select LINQ to SQL tools so that there is a check mark next to it, and click the Modify button at the bottom right corner of the window. Once this finishes and you go back into Visual Studio, the DBML file should now show up as a design surface instead of XML source code.

BTW, a posthumous Happy Birthday to Gilda Radner, who left us far too soon.

Swift app crashes with dyld Library not loaded message

So you are humming along on your new Swift app, and all of a sudden, when you bring in a framework revision or try to deploy to a device, you suddenly start getting dyld: Library not loaded messages when the app tries to launch.

Most likely, the reason for this is that the setting for embedding the Swift standard libraries is turned off, and the app for some reason needs them. The fix is easy enough, just go into your build settings for your app and look for “Always Embed Standard Swift Libraries”. Turn this setting on for your app’s target, clean, and then try to run again.

BTW, Happy 20th Anniversary to the iMac, which was announced to the world by former Apple CEO Steve Jobs on this date in 1998. I have had a few iMacs through the years, and they are great machines.

Simple React Native networking

If you are doing some cross platform mobile development, and find yourself in need of doing some simple React Native networking, never fear, fetch is here.

Here is a simple example of what one of your React Native files might look like. Keep in mind that I have gutted out a bunch of stuff from this file just to keep it readable, but you should get the idea from the networking functions getMoviesFromApiAsync() and moviesResponse() below.

import React, { Component } from 'react';
import { Platform, StyleSheet, View } from 'react-native';
import Styles from './Styles'
 
export default class Home extends Component<{}> {
 
  constructor(props) {
    super(props);
  }
 
  static navigationOptions = {
    header: (
      <View style={Styles.header}>
        <View style={{flex:1.0,justifyContent:'center',alignItems:'center'}}>
          <Text style={Styles.locBtnText}> Title </Text>
        </View>
      </View>
    )
  };
 
  render() {
    return (
      <View style={Styles.container}>
        {/* Your stuff goes here */}
      </View>
    );
  }
 
  {/* Networking call done here */}
  getMoviesFromApiAsync() {
    return fetch('https://facebook.github.io/react-native/movies.json')
      .then(response => response.text())
      .then(text => this.moviesResponse(text))
      .catch((error) => {
        console.error(error);
      });
  }
 
  {/* Response comes in here */}
  moviesResponse(text) {
    this.setState({waitCursorShowing: false});
    console.log("Movies response: " + text);
  }
 
}
 
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor:'white',
    alignItems: 'center',
    justifyContent:'center'
  },
});

BTW, Happy Anniversary to 2001: A Space Odyssey, which debuted to the public 50 years ago today. Sure it is a little slow, but oh what a jump cut.

WWDC goat rodeo

I have an idea for Apple on how to avoid the whole WWDC goat rodeo in terms of the tickets lottery. There are so many developers that do not get a chance to go to the event due to seats being taken up by people who only attend the keynote.

So here’s a thought, have separate tickets for the keynote and for the rest of the event. See, I’m an idea person.

BTW, a posthumous Happy Birthday to Denton “Cy” Young, one of the greatest pitchers in the history of baseball, born this date in 1867.

Back to the future?

What kind of sorcery is going with my framework modification dates?

BTW, a posthumous Happy Birthday to Mr. Fabulous, Alan Rubin. I feel the need now to go and watch Blues Brothers for like the 500th time.