Notepad++ regex capture groups: a=b to b=a

got some equations like

param1 = src.Name
param(2) = src.Width
param(3) = src.Name
param(1) = src.Name

and you want to change them to

src.Name = param1
src.Width = param(2)
src.Name = param(3)
src.Name = param(1)

Using Notepad++ Find and Replace: Regular Expression mode

Find ([^=\n\r])=([^=\n\r])
Replace With ${2}=${1}

Azure, Visual Studio: Add your Ionic/Angular/PWA (serverless computing?)

You’ve got a C# webapi that you’ve written in Visual Studio. You’ve got one or more Angular/Ionic/PWA front-endd. You want to host your front-end on the same Azure web app as the web api.

In VS Code, edit your angular app and make sure the API points to your url http://allmyapps.azurewebs.net/api

Compile your angular app using –prod

ionic build --prod

In VS, create a MyDogsApp folder, then create a Pre-Build Event

xcopy C:\Projects\MyDogs\www*.* C:\Projects\myapps\MyDogsApp /E /Y

In VS, build your project, and make sure the built files from your angular app get copied to the folder within your VS project

In VS, UNLOAD your project.

Now Edit your project (.csproj)

Add an ItemGroup

<ItemGroup>
    <Content Include="MyDogsApp\**" CopyToOutputDirectory="Always" />
</ItemGroup>

In VS, Reload your project.

In VS, Publish your project to a folder and check the MyDogsApp files are in a folder next to Content.

Next time you build, the latest build will be copied to the folder within your project. Then when you publish, those files will be copied to the output. So you can get to your wonderful front-end using

  https://allmyapps.azurewebsites.net/MyDogsApp

Embedding an Ionic app in a MVC / C++ web app

You want to embed a PWA version of your ionic app in your web site, but don’t want to pay to host another site (or have to remember another URL)

Build the prod version of your app

ionic cordova build browser

Ionic / Cordova wants a file at /config.xml, so copy your config.xml there

Create a folder for your ionic app in the project folder.
To get the published files into that folder, add a Pre Build Event.

xcopy C:\Projects\MyFluJab\platforms\browser\www*.* C:\Projects\faf02b\Faf02\MyFluJab /E /Y
xcopy C:\Projects\FafIonicAdmin\www*.* C:\Projects\faf02b\Faf02\FafAdmin /E /Y

Include it, and all the files, in the .csproj.
Right-click and Unload Project.
Right-click and Edit Project File.
Add the following ItemGroup:

You will need the following mime types in web.config

<system.webServer>

<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json; charset=UTF-8" />
<mimeMap fileExtension=".woff2" mimeType="font/woff2" />
<mimeMap fileExtension=".xml" mimeType="application/xml; charset=UTF-8" />
</staticContent>

VSCode, Typescript, Node : ts.cmd not found, exit code: 127

/usr/bin/bash: tsc.cmd: command not found
The terminal process terminated with exit code: 127

The full error message I got was

/usr/bin/bash: c:Projectsnicksprojectnode_modules.bintsc.cmd: command not found
The terminal process terminated with exit code: 127

This post: https://github.com/Microsoft/vscode/issues/35593 shows how to fix it: create a settings.json file in your project folder (c:\projects\nicksproject\settings.json) containing

{    
    "xxterminal.integrated.shell.windows": 
        "C:\\Program Files\\Git\\bin\\bash.exe",    
    "terminal.integrated.shell.windows": 
        "c:\\Windows\\SysWOW64\\cmd.exe"  }

IonicCourseCode1

declare var $:any;




function onClickButton(){

        let url = 'http://transportapi.com/v3/uk/train/station/exc/live.json?'

            +'app_id=*****&'

            +'app_key=******************';
//get your own app_id and app_key from http://transportapi.com/v3/uk

        $.get(url).then(

            (data:any)=>{

                var x = data;

                let element = document.getElementById("statusText");

                if(element != null){

                    element.innerHTML = '<ul>';

    

                    for(var i=0;i<data.departures.all.length;++i){

                        let itm = data.departures.all[i];

                        let itmString = '<li>Plat ' + itm.platform

                            + ' Time ' + itm.expected_departure_time

                            + ' To ' + itm.destination_name + '</li>';

                        element.innerHTML += itmString;

                    }

                    element.innerHTML += '<ul>';

                }

                

            }

        );  

}

//(see c:\users\IonicNinja\Documents\TestTrainTimetable\index.ts)

Azure DNS / HTTPS and FastHosts email

How to configure a domain name, https and email for your Azure web app

I tried (oh how i tried) to use a LetsEncrypt HTTPS certificate for my Azure-hosted web site by following Troy Hunt’s blog post

(all right, I gave it an hour…)

Then I looked more closely at the Azure portal and it turns out you can buy your domain and HTTPS certificate from there. It originally comes from GoDaddy and my legstat.org.uk domain plus certificate cost £50 ish (and a lot of clicking around).

How to buy a Top Level Domain from Microsoft Azure?

You have to go to Basic (more expensive) hosting to support https. On the plus side, now I can run my new site thru asafaweb without feeling bad…

And I also get an “Advanced DNS” page.

Now I want to send email from legstat.org.uk so I signed up for a fasthosts email account (£3/month).

To use this I have to “prove ownership”. This means 2 things

* Add some MX records
* Add a TXT record

I had a bit of trouble with the advanced DNS settings, but what they finally looked like was..

Visual Studio 2017: Program in Invalid State: disable javascript debugging

With VS2017 and an asp.net project, you may get “Cannot start program, it’s in an invalid state”. This may be related to “enable javascript debugging for asp.net (chrome and ie)”.

Try restarting Chrome, IE or Edge.

Try turning off javascript debugging: in the quick launch bar type “javascript debugging” and enter. This takes you to Tools-Options-Debugging-General. Find “enable javascript debugging for asp.net (chrome and ie)” and untick it.

References:

https://www.johanbostrom.se/blog/how-to-disable-the-built-in-chrome-from-starting-when-debugging-in-visual-studio-2017/