Monday, July 23, 2018

Command to get windows services and windows features

Following are the PowerShell script and Command to get the Windows Servers and Windows Roles and features list

Get Services using PowerShell

Import-Module Servermanager
Get-Service | Export-Csv -path "H:\SharePoint\Services_Features\MYUATSQL_services.csv"
Get-WindowsFeature | Export-Clixml "H:\SharePoint\Services_Features Report\MYUATSQL_features.xml"

Get Service logons details using command prompt.

wmic service get name,startname> "H:\SharePoint\Services_Features\MYUATSQL_serviceLogons.csv"

Wednesday, April 18, 2018

Android close app when back button is pressed using Xamarin c#

Requirement: Close the app when back button is pressed using C# in Xamarin.

Scenario: We may need to close the app when we press back button from app's home page

Code:
Use the following line of code in OnBackPressed event.

public class MainActivity : Activity
{
....
....
...
...

   public override void OnBackPressed()
   {
                base.OnBackPressed();
                var intent = new Intent(this, typeof(MainActivity)); 
                base.Finish();
                System.Environment.Exit(0);
    }
}


Thursday, January 11, 2018

Render JSON data in HTML using ReactJS

Following code is to render JSON data in HTML using ReactJS

HTML Code

<div id="root"></div>

JS Code
Load latest react scripts files.
Following script files were used in this example.
Add following code in to your script.
//Your JSON Data
var empdata = {
 content: {
     employee: [
       {
         name: "Joe",
         Age: 30,
         id : 1007
       },
       {
         name: "Bill",
         Age: 35,
         id : 1008
       }
     ]
  }
};
//Create Class
var Employees = React.createClass({
render: function() {
  //To retrieve keys from data.content
  var keys = Object.keys(empdata.content);
  //iterate through the keys to get the underlying values
  var allEmps = keys.map((t) => empdata.content[t].map((e) => ({e.id}-{e.name}-{e.Age})));
return ({allEmps})
}
});

//Render data to HTML
ReactDOM.render(, document.getElementById("root"));



Friday, March 23, 2012

Color is not showing properly in print out

Issue: Colors in the Web Page is not getting exact color when printed out.

Solution: Click File menu in the browser > select Page Setup > check Print Background Colors and Images. > Click OK

Saturday, July 2, 2011

Get first letter of each word in a sentence


 private string GetAcronym(string strSiteName)
        {
            string shortName = string.Empty;
            string[] txtArray = strSiteName.Split(' ');
     
       //if site name is a single word, get the first three characters of the site name
                if (txtArray.Length == 1)
                {
                    return strSiteName.Substring(0, 3);
                }

                //Get the first letter of each word in the site name
                foreach (string word in txtArray)
                {
                    shortName += word.Substring(0, 1);
                }
                return shortName;
            }

Tuesday, June 7, 2011

Unit testing Vs Integration testing Vs System testing Vs UAT Vs Smoke testing

Unit Testing
- Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.
- Unit tests are created by programmers or occasionally by white box testers during the development process.


Integration testing
- Individual software modules are combined and tested as a group.
- System integration testing is the process of verifying the synchronization between two or more software systems and which can be performed after software system collaboration is completed.
- It occurs after unit testing and before system testing
- The purpose of integration testing is to verify functional, performance, and reliability requirements placed on major design items


System testing
-  Once the system testing is done  the software is ready to ship
-  Done by QA at development end
- System testing of software or hardware is testing conducted on a complete, integrated system to evaluate the system's compliance with its specified requirements. System testing falls within the scope of black box testing, and as such, should require no knowledge of the inner design of the code or logic.
- It is also intended to test up to and beyond the bounds defined in the software/hardware requirements specification(s).


UAT
- User acceptance testing is testing conducted by users of the system
- Done by QA(trained like end users


Smoke testing
- Smoke testing refers to the first test made after assembly or repairs to a system, to provide some assurance that the system under test will not catastrophically fail. After a smoke test proves that "the pipes will not leak, the keys seal properly, the circuit will not burn, or the software will not crash outright," the system is ready for more stressful testing.


Source: Wikipedia

Monday, June 6, 2011

Deploying Assembly in GAC vs BIN


If you are frequently updating the Assembly, then you always better to deploy it in BIN.  Since, Assembly will be reloaded automatically just after the updating.    But when you update the Assembly in GAC, you have to restart the IIS (IISRESET) to grab the new version. The reason is GAC keeps the assembly in Cache.

When you deploy your Assembly on GAC then you can access the Assembly from any SharePoint web application. But when you deploy Assembly in web application’s BIN folder, then it can only access from the given web application. Anyway, if you have all-purpose web part, you better to deploy it in GAC and avoid the multiple Assembly deployments in BIN. 

If you have multiple versions of same Assembly, then you have to deploy it in GAC. Coz, GAC manages the multiple version of given Assembly, but BIN doesn’t