People Powered Movement Movement

PPMM

We live in a city where People Powered Movement, can account for much of our commuting and transit and encouraging the behavior is something I can get behind.

Cars are too fast for most city streets, 30 MPH should be the max speed of this city. And we should start enforcing that speedlimit for the safety of people in People Powered Movement Machines.

I have a pleasant corner office at 10th and Market, and I can see dozens of bikers and walkers everyday. I want to make it so they feel as safe if not safer than people in cars in the city.

SF Bicycle Coalition also needs some competition. So today, I’d like to announce the creation of the the PPMM.

A Biking Club with the focused interest on making roads safe for People Powered Movement Machines. Not just bikes, Skateboards, kick scooters, rickshaws, roller blades, roller skaters, those cool cross country ski trainer things, heelys, etc. have a safe commute in our city.

#PPMM

I have a slight sensation that PPMM might mean something else… But I’m going to stay ignorant and positive for now.

If you bike in SF, you’re probably familiar with this arrangement.

Getting DotNet Core on your computer – Part 1/3: Clean Environment

I’m almost impressed with how difficult of a time I’ve had with using DotNet Core on my windows machine.

I’m not a regular .NET developer, but I have built a number of different tools, functions, PoCs with C#.

While I’m at it, this is one of the main reasons I’ve struggled grokking .NET to help people. The versioning and naming convention issues. C# is an incredibly robust and articulate language, with an incredible diverse set of tools and services. Once your over the hurdles the potential to be productive at Common Enterprise Scale is supes appealing. But before that, I need to get the stuff working in a flexible manner on my computer because I work in many different environments.

Maybe I’m approaching it the wrong way, maybe I should create a VM and do all my work on that? Maybe I should reimage my computer everytime I start a new project? This seems rather silly though. The ability to build, debug, test, and release projects from your own computer seems like one of the compelling reasons to use C#. In some ways, it’s design aligns with the Operating System of windows. Most specifically .dll files. Learning .NET has been a slow process some of the books I’ve read include: “The Yellow Book of C#” and “Functional Programming in C#”. One of the things I struggle with is the stuff in between. I want to move beyond class declaration but not quite all the way into Functional Programming.

So… here I am wanting to learn more and many projects I’ve been working on include a Web components, so ASP.NET Core stand out to me right away. The tough thing here is that to practice writing production code you should design your projects and solutions in a way that optimizes for testing and deployment pipelines. Following best practices from the get go with C# is a bit tricky. So I found this course about testing with ASP.NET Core MVC Unit Testability.

Now I’m stoked to go through this content, but before I do I’d like my dev environment to be similar or at lease working int he same way as Benjamin Day, the author of this course.

Okay, so to begin, I have a couple versions of .NET installed on my computer. But I’m going to uninstall everything to start. I’m also going to uninstall VS Code and all extensions because things were acting weird there as well.

First I uninstalled VS code from the Apps and Features page of the settings in Windows 10!
Then, I found this post for uninstalling VS Code extensions: https://stackoverflow.com/questions/36746857/completely-uninstall-vs-code-extensions
And this one from Scott Hanselman for uninstalling Dotnet Core: https://www.hanselman.com/blog/ScriptsToRemoveOldNETCoreSDKs.aspx
Then I went into my Apps and Features and uninstalled them again…
I even checked my paths, both User and System variables.
I’m also deleting “.omnisharp”, “.nuget”, “.vscode” from my user folders.

And then restart your computer, because that may have been the solution all along \__0__/

So, should have a nice clean environment

Okay have you done all that???
That should take an hour to make sure everything is gone…

Now let’s install dotnet core… http://timmyreilly.azurewebsites.net/installing-dotnet-core-on-windows/

But first a photo:

Picasso’s got me inspired

Missing The Blog – MeatSpace Part Two

I’ve been missing blogging heavily.

I’ve been rearranging my desk at home, and I think the reconnection with my home workspace made me nostalgic for taking time to blog.

So, as a personal way to kick things off, I want to revisit meatspace…

This photo comes courtesy of the corner of Irving and 22nd… Maybe… Right across from the Cricket store. Anyways, does this billboard have googly eyes???

Oh dear, our Norfolk Pine is dying and we don’t know what to do. It’s now sitting outside, in the cold, waiting for us to reuse the planter and it makes me sad.

Look at this big pups footsies! We took this Photo in Barcelona, I’m impressed with the amount of bakeries in Barcelona and how awesome-terrible a Nutella Croissant could be.

Holy friojoles, one last photo from Barcelona, this one is Sagrada Familia. If you go, I’d recommend waiting to the light is just right and waiting for the space to clear out a little at the end of your reservation for an incredible view of color and architecture. One of the few times I’ve been left awestruck.

Major Key – webpack init

Webpack Init

Why isn’t that the default instruction.
Its the most complicated thing and does all sorts of crazy stuff, I always end up breaking it, and it has an initialization command.

> webpack init

Then, you need to set the development mode or this will bug you… Forever.
They even ask you if you’re going to run this in production during the init script.
What the heck?

Angles!
Angles!

Hacking the Microsoft Hack

Thanks for listening to my spiel!

Photos from:

Microsoft Cloud Info
Regions
About
All the Stuff

4 Relevant Services
Cosmos DB
Web App in Demo
Virtual Machines
Web Apps
Functions
GitHub Deployment Bing Maps
Office Graph
Cloud APIs
Bing Knowledge, Images, NewsCognitive Services:
Bot Framework
docs.microsoft.com for everything!

Important Hack Principals
Come up with a good idea
Visit Devpost
Go Visit the Booths
Send in your resume
Don’t spin your wheels
Use GitHub Search
Use GitHub workflowsCreate something you want to use!

Ask us questions: @timmyreilly

Maker:S,Date:2017-9-16,Ver:6,Lens:Kan03,Act:Lar02,E-Y
Maker:S,Date:2017-9-16,Ver:6,Lens:Kan03,Act:Lar02,E-Y

Bot Demo and Azure Resources

Hope you enjoyed the demo!

Here are the resources I used to build the demo this evening:
Microsoft Bot Framework SDK
PayPal Demo Source Code
Microsoft Cognitive Services
Microsoft Language Understanding and Intelligence Service (LUIS)
Microsoft Azure Web Applications
Visual Studio Code

Here’s a couple more resources for you to consider as you make the leap into bots

Microsoft Case Studies
Real World Code
Bot Framework SDK
Bot Builder Examples
Bot Builder Node Samples
Bot Builder C# Samples
Location Dialog
FAQ Builder
Bot Directory – Check out Murphy Bot
And Hipmunk Bot for Skype

Azure Resources:
Data Center Geography
Azure Pricing Calculator
Support your Startup with BizSpark
Azure Homepage
Azure Video Series

Cognitive Services:
Overview
Main Page

If you have any specific questions feel free to reach out to me on twitter: @timmyreilly

Ocean Beach!
Ocean Beach!

Using Deployment Slot Settings in Azure Web Apps

This post elaborates on a specific learning from our work Athena Intelligence.

One great feature of Azure Web Apps is deployment slots. I recently had an excellent use case for them as a small startup I’m working with is trying out ASP.NET MVC. In the process, we learned how effectively deployment slots allowed their team to work on the project commit code, test it against a test DB as if in production, then quickly swap when ready to the new site and the production database.

Here’s a quick sketch to highlight what I’ll be demoing today:
staging-slots-overview

Prerequisites:
Azure Subscription
GitHub Account + Git Installed

This tutorial provides a specific workflow for deploying and testing code using Visual Studio 2015, Azure SQL Server, and Web Apps for Azure. It is designed to help you quickly get resources into the clowd, supporting users, testing deployments, working with a small devops cycle and learn by doing.

There are 10 parts to this tutorial:
Creating a Azure SQL Server Instance in a Resource Group
Creating a Web App in Visual Studio
Push Your Project to GitHub and add Version Control
Create a Web App in Azure
Create a deployment slot
Connect the Staging Slot to your GitHub Repository
Update the Application Settings to connect to your Test Database
Check Data is Entering the Database
Move onto production setup
Make the swap

1. Creating a Azure SQL Server Instance in a Resource Group

Go to https://portal.azure.com

Select new > SQL Database

Database name: TestDatabaseJanuary
Create new or use existing Resource group (creating a new one makes it easier to tear down when done)
Server: Create a new server – name = januarysqlserver, admin login = conductor, password = d0nt4get! location = same as everything else in Resource group
Select a price and select create.

Here’s what it looked like for me:
CreatingTestDatabaseandServer

After the SQL DB instance is spun up and the database is provisioned, go to the overview page.
In the top right corner you can see the name of the server hosting this DB, and a show connection strings link:
TestDatabaseSQLServer

After selecting that link, you’ll see a number of different connection strings. In this case, we’ll be using ADO.NET to connect to it from an ASP.NET web application.
DatabaseConnectionStringsAzure
Keep track of that string. You’ll also notice that the ‘username’ and ‘password’ are left empty. That’s the username and password you set when you created the SQL server instance.

Now that we have a Database ready to go, let’s get a web app connected to it.

2. Creating a Web App in Visual Studio

Open up any Edition of Visual Studio 2015 and select File > New Project.

Then select Templates > Visual C# > Web.
You’ll see ASP.NET as an option.
Give it a name e.g. MyDemoApp
Then Press okay.
CreatingWebAppPart1

You’ll then be met with an MVC Scaffolding page:
SelectingMVCIndividualAccounts

Select MVC and make sure the authentication is “Individual User Accounts”
For now I’ve unselected "Host in the Cloud" we’ll take care of this later.

Press Okay again and you’ll soon have a basic web application using ASP.NET MVC with User Authentication Cooked In.

Press F5 or select the green arrow on the toolbar of Visual Studio to see you application:
Right now when you register an account you’re updating a localdb called MSSQLLocalDB
DefaultWebApp

BONUS: You can test your database from your local machine by editing your Web.Config Connection strings.
Change the “DefaultConnection” from local to the string connection string provided by the Azure SQL Server Instance:
WebconfigLocal
This isn’t required for this tutorial but good to know if you want to see if its working meow.

3. Push Your Project to GitHub and add Version Control

In this case we’re going to use Git via the command prompt. Open up a command prompt to you DemoApplication Directory:
commandpromptgitignore
And enter the command C:\echo > .gitignore
This will create a .gitignore file. We want this file next too your .sln file.

Open the .gitignore file with your favorite text editor and copy the contents of this file into it:
https://raw.githubusercontent.com/timmyreilly/ASPNETDeploymentDemo/master/.gitignore

Should look like this, make sure *.mdf and *.ldf are in your .gitignore:
YourGitignore

Save the file and close the text editor.

Now go to GitHub.com and create a new repository:
CreateGitHubRepo

Next, Initiate the repository, add your files, and commit your code.
These instructions on the github page are accurate:
FollowTheseGitInstructions
And here they are again:

C:\ echo # MyDemoApp >> README.md
C:\ git init
C:\ git add .
C:\ git remote add origin http://yourrespoastaoisdgaosuhd.git
C:\ git push -u origin master

And what it looked like on my machine:
InitialCommit

Great!
YouShouldHaveGitHubLikeThis

You now have code in a GitHub repository that you can share with lots of different developers.
As they push changes we want to see how they look and if they break the application, so let’s go create a web app.

4. Create a Web App in Azure

Go to the Azure Portal and the resource group that has the SQL Database we created earlier
Select add in the top left corner > Then Search Web App:
creatingawebapp

Here you can see I’ve configured the name and placed it in the same resource group.

After that’s provisioned we can can make our first deployment slot!

5. Create a deployment slot

Go to the overview blade of your Web App and select “Deployment Slots”
SelectDeploymentSlot

Then Add Slot in the top left corner.
Now create a slot called “staging”
createstagingslot
You can create as many slots as you want. They are essentially other Web Apps that are related to each other.

It will take a second to spin up, but once ready you can treat it like its own web app.

6. Connect the Staging Slot to your GitHub Repository

Select the staging slot and select “Deployment Options”:
SelectDeploymentoptionsOnStagingSlot

You now get to pick a deployment source. In this case, we’re going to use GitHub. You’ll authorize Azure to pull your repositories and choose the ASP.NET Project you created a repository for in step 3:
SelectGitHubDeployment

7. Update the Application Settings to connect to your Test Database

Now that the project is deploying from the GitHub we need to connect it to a database to support the user login functions.
We have the code, now we need the data.
Go to the Application Settings and scroll down to connection strings.
Set the name to: DefaultConnection
And the Value to something like this: Server=tcp:januarysqlserver.database.windows.net,1433;Initial Catalog=TestDatabaseJanuary;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

This is the connection string we took down in step 1.
Note: the {your_username} and {your_password} needs to be substituted with the SQL Server settings you set during step 1. It can be helpful to make the changes in a text editor before copying into that small textbox.

Also make sure you mark this as a slot setting. This tags this setting to only be used in this slot and is really the meat of this whole operation.

Here’s what that looked like for me:
ApplicationSettingsForStagingSlot

Go back to the overview for the staging slot and select the url to visit your new site. Try registering some accounts and making sure everything works properly. If you get errors during registration that might be because the string was copied improperly or you used the wrong username and password. Try again, that’s what the cloud is for!

Here’s my site url and me registering an account:
RegisterTestAccount

Nice!

8. Check Data is Entering the Database

Visual Studio 2015 has a SQL Object Explorer cooked in! It makes it super easy to check the state of your database and make sure you’re getting data.

Go to Visual Studio select View -> Server Explorer from the toolbar.
OpenSQLExplorer
Now select connect to Azure Subscription if there isn’t one there already.
ServerExplorerAfterLogin
Login with the same credentials you do when you go to the portal in the browser.
Once connected drop down into SQL Databases and right click on the “TestDatabase” and select “Open in SQL Server Object Explorer”
OpenSQLObjectExplorer
Now open YouDatabaseName > Tables > Right Click AspNetUsers > Select “View Data”
RightClickViewDataOnUsers
Here’s a couple results from my data:
DataIsInTestDB

Isn’t that sweet!?

9. Move onto production setup

Now we have a working web app talking to a test database. Let’s create a production Database just like we did in step one and connect our web app to that.
I followed the same steps as Step 1, but now named the Database JanuaryDemoProductionDB:
ProductionDBConnectionString

And grabbed the connection string:
Eg: Server=tcp:januarysqlserver.database.windows.net,1433;Initial Catalog=JanuaryDemoProductionDB;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

Now let’s go place this in our original Web App Connection string.
Don’t forget to mark it as a slot setting.
ProductionWebAppConnectionString

Okay, time for the big finale. This represents the future of our development workflow.
Let’s go make a small change in our local copy of the web app.

Here you can see I changed the text on the home page:
SmallChangeToHomePage

Now we commit the change and push to github:
committingthesmallchange

The Staging slot picks up on this change and deploys the changes to our staging slot:
smallchangeinstaging

We check the staging slot site to make sure everything is still working
SmallChangePassesTesting
Looks good! And we can still login with our test accounts.

10. Make the Swap!

Now let’s put it into production!

Select Swap from the Overview Blade of our Main Web App (not staging):
SelectSwapFromProductionWebApp

Select the source and destination of the swap:
AboutToSwap

And wait a minute:
SwapInProgress

Now go visit your production site!
http://test-january-webapp.azurewebsites.net/

And try to login with one of your test accounts.
No Luck!
This slot is now on its own db.
InvalidLoginAttempt

Not very often you get to be excited about invalid login attempts!

10b. Finally

Now you can keep pushing changes to GitHub without worrying about messing up your production environment. After everything checks out, you can push it over to production and your customers.

Thank you deployment slots!

Let me know if you have any questions in the comments below or say hi on Twitter: @timmyreilly

Really looking forward to the next generation of Surface.
Really looking forward to the next generation of Surface.