Thursday, March 28, 2019

Useful Windows Command Prompt Commands

1. Command History: You can track down your command history.
c:\> doskey /history

2. Run multiple commands:You just need to put “&&” between each command and save some time.
c:\>winword && notepad && msexcel

3. See PC driver list :You can see all the drivers installed on your computer.
c:\>driverquery

4. Send an output to clipboard: Save the output of a command.
c:\>ipconfig /all | clip

5. Create Wi-Fi hotspot right from the command prompt
Before opening the Command Prompt to execute the commands needed for this, you need to open Control Panel and find Change adapter settings in the Network and Sharing option. There, click on the connection you are using and click on Properties. Now find the sharing tab and check the option “Allow other network users to connect through this computer’s internet connection.”

-Open the Command Prompt with administrative privileges and enter the following command to enabled hotspot:
c:\> netsh wlan set hostednetwork mode=allow ssid=Youthotspotname key=yourpassword

-start the Wi-Fi hotspot
c:\>netsh wlan start hostednetwork

-To stop it, simply enter this command:
c:\>netsh wlan stop hostednetwork

Wednesday, March 20, 2019

Upload Attachment to SharePoint Site List Item

Application Form Window

Replace "Tab Character" in Excel Active Sheet

TAB - horizontal tab Decimal Value is 9


Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim lRow As Long
Dim lCol As Long
   
    'Find the last non-blank cell in column A(1)
    lRow = Cells(Rows.Count, 1).End(xlUp).Row
   
    'Find the last non-blank cell in row 1
    lCol = Cells(1, Columns.Count).End(xlToLeft).Column

For i = 1 To lRow
    For j = 1 To lCol
        t = Cells(i, j).Value
        If (Len(t) > 0) Then
            If (Asc(Left(t, 1)) = 9) Then
                str1 = Mid(t, 2, Len(t))
                Cells(i, j).Value = str1
            End If
        End If
    Next
Next

End Sub

Thursday, March 14, 2019

Rest API to check field value contains...

[site url]/_api/Web/Lists/GetByTitle('myList')/items/?$filter=substringof('ABC',Title)

Filter Unique Value in Array


var items = ['abc','pqr','abc','xyz','pqr','abc'];
var result = items.filter(UniqueElement); 

//result ['abc', 'pqr','xyz']


function UniqueElement(value, index, self) { 
    return self.indexOf(value) === index;
}

Saturday, March 9, 2019

Simple way to Check if JSON is correct or not..

function IsJsonString(str) {
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}

Remove control characters from a string

function removeCC(s) {
  /* Remove NewLine, Carriage Return and Tab characters from a String  */

  r = "";
  for (i=0; i < s.length; i++) {
    if (s.charAt(i) != '\n' &&
        s.charAt(i) != '\r' &&
        s.charAt(i) != '\t') {
      r += s.charAt(i);
      }
    }
  return r;
  }

Same thing with regular expression


function removeCC(s){ 
  return s.replace(/[\n\r\t]/g," "); 
}

Friday, March 1, 2019

Custom button in DataTable

DataTable Example:

(1)Add custom button

"buttons": [{"text": ' Custom Button',
        "action": function () {
                                alert("Custom Button Clicked");
}
        },
]


(2) Button Menu

"buttons":[
                {
                extend: 'collection',
                text: 'Menu',
                className: "menuMain",
                autoClose: true,
                buttons: [
                    {
                        text: 'Item 1',
                        action: function () {
                            alert("Item 1 Selected");
                        }
                    },
                    {
                        text: 'Item 2',
                        action: function () {
                            alert("Item 2 Selected");
                        }
                    }
                ]                           
                             },
                  ]