Configured debug type ‘pwa-chrome’ is not supported when debugging Cordova app in Visual Studio Code

When trying to debug an Ionic Angular application in an older version of Visual Studio Code, this error shows up.

Follow the checklist

  • Use a Visual Studio Code version that supports debugging, if your code is too old newer versions will stop working.
  • Make sure the Chrome Debugger extension is installed and enabled, if it’s greyed out in the Extension list, uninstall and reinstall it.
  • Do the same thing for Cordova Tools extension, if you can’t find it, use an even older version of VSC.
    • The safest bet is to use the version used to develop the app.

The best way is to update your code base to newer versions of languages, frameworks and libraries so you can use newer tools to debug the application. Otherwise this is a workaround.

How to get raw query generated by Elasticsearch NEST library for debugging purpose

Source: https://stackoverflow.com/questions/28939022/get-raw-query-from-nest-client/50023531#50023531

For NEST / Elasticsearch.NET v6.0.2, use the ApiCall property of the IResponse object. You can write a handy extension method like this:

public static string ToJson(this IResponse response)
{
    return Encoding.UTF8.GetString(response.ApiCall.RequestBodyInBytes);
}

Or, if you want to log all requests made to Elastic, you can intercept responses with the connection object:

var node = new Uri("https://localhost:9200");
var pool = new SingleNodeConnectionPool(node);
var connectionSettings = new ConnectionSettings(pool, new HttpConnection());
connectionSettings.OnRequestCompleted(call =>
{
    Debug.Write(Encoding.UTF8.GetString(call.RequestBodyInBytes));
});

You need to call on the ES client connection setting object to allow reading request JSON. This is best done on DEBUG mode.

connectionSettings.DisableDirectStreaming(true)

Finding the code that started an Ajax request from Chrome Dev Tools

It’s possible to trace back to the code that triggered an Ajax call from the Network tab of the Chrome Developer Tools.

From the network tab, simply check the initiator column of the request list, by hovering the mouse over it the stack trace that lead to that request will be displayed.

C# String problems

When retrieving HTML or string content from some editors such as SharePoint editor, the editor may insert zero-width or control characters in the content that can cause problem methods like string.IndexOf, string.Compare, string.Replace etc.

If the application only uses English language, it’s possible to strip all control characters from the data before doing other string operations.

Use the Regex to do so

data = Regex.Replace(data, @”[^x20-x7F]”, “”);

This line will remove all characters that are not in the range 0x20 to 0x7F in the ASCII table.

Then proceed to do string operations as per normal.

Cannot get workflow to trigger event receiver

Change the sequence number of the receiver in Elements.xml to a lower value so that the receiver will run before the workflows?

Another way is to actually update the list item inside the workflow, usually assigning the same value to the field will work and results in no change to the list item.

Please note that workflow status is set asynchronously, meaning if you make the workflow trigger the event receiver and inside event receiver you read the workflow status, the workflow status is not guaranteed to be correct at the time as the update happens asynchronously.

The best way to read the eventual workflow status is to write it to a list item’s field and read from there in the event receiver.

Disable button on submit using javascript to prevent double clicking

Disable button on submit instead of onclick

Use this code?

Button is not firing postBack because you have disabled this. The approach to avoid multiple postBack is to have two buttons side by side. Real and dummy. On first click hide/delete the real button and show the dummy one
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" ClientIDMode="Static" OnClientClick="disableButton();"/>

<asp:Button ID="ButtonDummy" runat="server" Text="Button" ClientIDMode="Static" OnClientClick='return false;' style="display:none;"/>
and JS:
function disableButton() {

 $("#Button1").hide();

 $("#ButtonDummy").show();

 return true;
 }
shareimprove this answer

Allow ASP.NET form to be used after downloading a file in SharePoint webpart

Solution: the most effective solution: add “_spFormOnSubmitCalled=false;_spSuppressFormOnSubmitWrapper=true;” to OnClientClick of the button

<asp:LinkButton ID=”lbExport”
runat=”server” Text=”Export”
OnClick=”lbExport_Click”
OnClientClick=”_spFormOnSubmitCalled=false;_spSuppressFormOnSubmitWrapper=true;”/>

Solution:

Add this code to the .ascx file

<script type=”text/javascript”>
    function setFormSubmitToFalse() {
        setTimeout(function () { _spFormOnSubmitCalled = false; }, 3000);
        return true;
    }
</script>

Then, for the download button, add the code to call this function after user clicks it

OnClientClick=”setFormSubmitToFalse”

Another way is to refresh the page on client after certain time

onclientclick="timedRefresh(2000)"

then in your html..

    <script type="text/JavaScript">
    <!--
    function timedRefresh(timeoutPeriod) {
        setTimeout("location.reload(true);",timeoutPeriod);
    }
    //   -->

Allow workflows to change approval status

Follow the instructions of the last answer at the end of the page.

https://social.technet.microsoft.com/Forums/office/en-US/9292c3ef-b456-4115-8b9c-bfa63782dfd5/workflow-can-use-app-permissions-feature-is-not-activating?forum=sharepointadmin

If Workflow Service Application is not displayed, enabled it by launching the Farm Configuration Wizard.