Tuesday, October 29, 2019

Remove special characters from the Folders and files using PowerShell script

#To remove the special characters from the Drive. Use the following PowerShell script



$Folder = "D:\TCA"
$Items = Get-ChildItem -Path $Folder -Recurse

#Add special characters that need to be renamed or removed
$UnsupportedChars = '[#%]'

foreach ($item in $items){
    filter Matches($UnsupportedChars){
    $item.Name | Select-String -AllMatches $UnsupportedChars |
    Select-Object -ExpandProperty Matches
    Select-Object -ExpandProperty Values
    }

    $newFileName = $item.Name
    Matches $UnsupportedChars | ForEach-Object {
        Write-Host "$($item.FullName) has the illegal character $($_.Value)" -ForegroundColor Red
        #These characters may be used on the file system but not SharePoint
        if ($_.Value -match "#") { $newFileName = ($newFileName -replace "#", "") }
        if ($_.Value -match "%") { $newFileName = ($newFileName -replace "%", "") }
     }
     if (($newFileName -ne $item.Name)){
        Rename-Item $item.FullName -NewName ($newFileName)
        Write-Host "$($item.Name) has been changed to $newFileName" -ForegroundColor Green
     }
}

Wednesday, January 30, 2019

Date format issue for some users

Scenario #1:
The RDS server is migrated to different region DC.

Issue:
When existing users access the MS access as remote app, they get date format issue.

Error message:
Your system is configured for American date format mm/dd/yyyy. Please change the regional settings to Australia and try again

Scenario #2:
Date format not showing correctly in server for some users when they remotely login to the server

Issue: Some users still see the date format as MM/dd/yyyy even though it is set to dd/MM/yyyy.

Troubleshooting: Since the issue is occurring only for some users, it's more related to user profile

Resolution: Delete the stored user profile from the server for existing users. Since the existing user profile are stored and that regional details are displayed based on user profile stored. Once the existing user profiles are delete, a new user profile is created and saved when user logins in again.

Steps to delete the user profile

  1. Run > sysdm.cpl to open System Properties window
  2. Click on Advanced tab
  3. Click on Settings button under User Profiles section
  4. Select the user profile with issue and click Delete User Profile

Note: If Delete button is grayed out/disabled, make sure that user does not have any active/disconnected session. You can check this in Task Manager > Users. Log off the user and try to delete again.

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

Friday, January 7, 2011

Visual Studio 2010 Setup failed in Windows 7

Environment: Windows 7 Professional, Visual Studio 2010 Ultimate























Resolution:
1. Uninstall Visual Studio 2010
2. Copied the VS 2010 Setup files from the DVD to my local hard drive

3. Disabled anti-virus in my PC

4. Start the installation again by running the setup exe file with "Run as administrator" option


Installation completed successfully with the above procedure.




--------------------------------------------------------------------------------

Thursday, December 30, 2010

Local Service vs Network Service vs Local System Account


Local Service

The LocalService account is a predefined local account used by the service control manager.It has minimum privileges on the local computer and presents anonymous credentials on the network. Name of the account must be NT AUTHORITY\LocalService.

Network Service

The NetworkService account is a predefined local account used by the service control manager. It has minimum privileges on the local computer and acts as the computer on the network. A service that runs in the context of the NetworkService account presents the computer's credentials to remote servers. Network Service presents the machine credentials on the network, the remote token contains the "EveryOne" and "Authenticated User" group SIDs.

Local System

The LocalSystem account is a predefined local account used by the service control manager. It has extensive privileges on the local computer, Local System acts as the machine account on the network. Its token includes the NT AUTHORITY\SYSTEM and BUILTIN\Administrators SIDs; these accounts have access to most system objects. The name of the account in all locales is .\LocalSystem. The name, LocalSystem or ComputerName\LocalSystem can also be used. Localsystem is the most privileged account in a system, it's the only account that is able to access the security database (HKLM\Security). It's token contains the SID's of NT_AUTHORITY\SYSTEM and Builtin\Administrators.


Running a service as Local System is not recommended because it has powerful access to local resources, and Network Service should be used if possible.
A Local service running as Local System and Network Service behaves the same. It is because the local service running as Local System or Network Service is authenticated as machine account to remote services. Therefore, while Network Service is great for protecting local resources, it does not protect remote resources.



source: http://msdn.microsoft.com/en-us/library/ms686005(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms685981(v=VS.85).aspx

Thursday, December 23, 2010

SharePoint Architect Skill set

Infrastructure Level/Operational

1. Capacity Planning (Scalability)
2. Physical Architecture (Farm Setup, Network, OS, Licensing)

Application level (Functional and Non-Functional)

1. Knowledge of 3rd party webparts
2. Requirement and Feasibility Analysis (Custom Vs OOTB Development/Implementation)
3. Techno-functional Mapping of requirements
4. Information Architecture
5. Logical Architecture
6. Conceptual Architecture
7. Detailed Design
8. Database design (not in terms of traditional Database design), this is with respect to Number of content Databases for Site collections/web apps.
9. Experiences with SharePoint Integration - this comes in two equally important flavours - both from SharePoint accessing existing systems (business catalogs, webparts, etc), as well as other systems accessing SharePoint content via webservice or API.
10. Read SharePoint code using reflector


Deployment

1. Best way to go for deployment, first time and incremental

Migration

2. SharePoint upgrade from v2 (MOSS 2003) to v3 (MOSS 2007).

Others

1. collaboratively work is the Project Manager in Planning, Estimation, Execution/Implementation, Risk Management (assessment, mitigation).
2. Apart from his daily tasks of working with technical teams, testers, User Interface professionals, Vendors, Clients (Business and IT teams).
3. Interacting with Enterprise Architect groups if any.
4. Have at least 5 SharePoint blogs
5. Attend local SharePoint usergroups

Reference:
1. http://blog.furuknap.net/the-role-of-a-sharepoint-architect
2. http://blogs.msdn.com/b/joelo/archive/2007/07/23/depth-and-breadth-in-a-sharepoint-architect-skills.aspx

Software Development Process

Requirements Analysis

Get the requirements from the client/customer. Make sure you identify incomplete, ambiguous or contradictory requirements.

Refer: http://en.wikipedia.org/wiki/Requirements_analysis

Specification

Specification is the task of precisely describing the software to be written. Specifications are most important for external interfaces that must remain stable.

Refer: http://en.wikipedia.org/wiki/Software_requirements_specification

1 Table of contents

1.1 Introduction

1.1.1 Purpose
1.1.2 Scope
1.1.3 Definitions, acronyms, and abbreviations
1.1.4 References
1.1.5 Overview

1.2 Overall description

1.2.1 Product perspective
1.2.2 Product functions
1.2.3 User characteristics
1.2.4 Constraints
1.2.5 Assumptions and dependencies

1.3 Specific requirements

1.3.1 External interfaces

1.3.1.1 User interfaces
1.3.1.2 Hardware interfaces
1.3.1.3 Software interfaces
1.3.1.4 Communication interfaces

1.3.2 Functional requirements
1.3.3 Performance requirements
1.3.4 Design constraints
1.3.5 Reliability
1.3.6 Availability
1.3.7 Security
1.3.8 Portability

1.4 Appendixes


Software architecture

The architecture of a software system refers to an abstract representation of that system. Architecture is concerned with making sure the software system will meet the requirements of the product, as well as ensuring that future requirements can be addressed.
Refer: http://msdn.microsoft.com/en-us/library/ee658098.aspx
http://msdn.microsoft.com/en-us/library/ee658084.aspx

Design

Software design is a process of problem-solving and planning for a software solution. After the purpose and specifications of software are determined, software developers will design or employ designers to develop a plan for a solution. It includes low-level component and algorithm implementation issues as well as the architectural view.


Implementation

The purpose of programming is to create a program that exhibits a certain desired behaviour. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic.Reducing a design to code may be the most obvious part of the software engineering job, but it is not necessarily the largest portion.


Testing

Testing of parts of software, especially where code by two different engineers must work together, falls to the software engineer.


Documentation

An important task is documenting the internal design of software for the purpose of future maintenance and enhancement.

Deployment

Deployment is all of the activities that make a software system available for use. The general deployment process consists of several interrelated activities with possible transitions between them. These activities can occur at the producer site or at the consumer site or both.
Refer: http://en.wikipedia.org/wiki/Software_deployment

Maintenance

Software maintenance in software engineering is the modification of a software product after delivery to correct faults, to improve performance or other attributes.Maintaining and enhancing software to cope with newly discovered problems or new requirements can take far more time than the initial development of the software. Not only may it be necessary to add code that does not fit the original design but just determining how software works at some point after it is completed may require significant effort by a software engineer. About 60% of all software engineering work is maintenance, but this statistic can be misleading. A small part of that is fixing bugs. Most maintenance is extending systems to do new things, which in many ways can be considered new work.

Refer: http://en.wikipedia.org/wiki/Software_maintenance

Tuesday, May 26, 2009

The process cannot access the file because it is being used by another process

Some times you get error "The process cannot access the file because it is being used by another process" when building a project in Visual Studio 2005.

We can resolve this by temporarly renaming the .pdb files, and build the project. Later delete the renamed file.