Monday, 28 December 2015

SQL table compare between 2 databases

SQL Server Data Tools for Visual Studio 2013 -Run as Administrator
TOOLS-->SQL Server-->New Data Comparison...
Click on New Connection..under Source Database
Select SQL Server Name and DB Name
Click on New Connection..under Target Database
Select SQL Server Name and DB Name
Click Next
Select Tables which you want to compare
Finish
You will see data difference b/w 2 DBs

Monday, 21 December 2015

CMD - Read folder file Name using cmd

Open CMD
go to directory
cd c:\myfolder
dir *.xml
dir /B *.xml >t.txt

You will get all file name


Monday, 14 December 2015

Sql Querry to find all active DB connection

SELECT DB_NAME(dbid) AS DBName,
COUNT(dbid) AS NumberOfConnections,
loginame
FROM    sys.sysprocesses
GROUP BY dbid, loginame
ORDER BY DB_NAME(dbid)

Sunday, 13 December 2015

Microsoft Azure

https://mva.microsoft.com/colleges/azure-iaas-for-it-pros

Friday, 4 December 2015

Aras Innovator Disconnect all users from the database

Disconnect all users from the database

--Change the database connection string in the InnovatorServerConfig.xml from “<DB-Connection…” to <xDB-Connection” and restart the w3svc service(IIS).  This expires all sessions and prevents all new connections to the Aras Innovator database through the existing instance

Monday, 30 November 2015

Wednesday, 25 November 2015

C# create GUID

            Console.WriteLine(@"System.Guid.NewGuid().ToString() = " + System.Guid.NewGuid().ToString());
            Console.WriteLine(@"System.Guid.NewGuid().ToString(""N"") = " + System.Guid.NewGuid().ToString("N"));
            Console.WriteLine(@"System.Guid.NewGuid().ToString(""D"") = " + System.Guid.NewGuid().ToString("D"));
            Console.WriteLine(@"System.Guid.NewGuid().ToString(""B"") = " + System.Guid.NewGuid().ToString("B"));
            Console.WriteLine(@"System.Guid.NewGuid().ToString(""P"") = " + System.Guid.NewGuid().ToString("P"));

Tuesday, 24 November 2015

Remove “Restricted User” in SQL Server

Remove “Restricted User” in SQL Server
---------------------------------------------------------------
 
Use DatabaseName
ALTER DATABASE DatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE DatabaseName SET MULTI_USER
GO

Monday, 16 November 2015

Thursday, 12 November 2015

sql multiple inner joins to same table



CREATE TABLE Table1
([weddingtable] int, [tableseat] int, [tableseatid] int, [name] varchar(4),
    [Created] int,[Modified] int)
;

INSERT INTO Table1
([weddingtable], [tableseat], [tableseatid], [name],[Created],[Modified[)
VALUES
(001, 001, 001001, 'bob',1,2),
(001, 002, 001002, 'joe',2,3),
(001, 003, 001003, 'dan',2,2),
(002, 001, 002001, 'mark',3,1)
;

CREATE TABLE Table2
([weddingtable] int, [tableseat] int, [meal] varchar(7))
;

INSERT INTO Table2
([weddingtable], [tableseat], [meal])
VALUES
(001, 001, 'chicken'),
(001, 002, 'steak'),
(001, 003, 'salmon'),
(002, 001, 'steak')
;
 
 CREATE TABLE usert
([userID] int,  [userName] varchar(7))
;
                                                                         
INSERT INTO usert
([userID], [userName])
VALUES
(1, 'A'),
(2, 'B'),
(3, 'C')
;
       
-----------------------
--Query

select * from Table1 t1
inner join usertable u
on t1.cre=u.userID
inner join usertable u1
on t1.Mod=u1.userID                                                                   

Tuesday, 10 November 2015

Programmatically adjusting the "toolbar type of a ListViewWebPart using Powershell script"

I have a requirement to hide new item or edit list in SharePoint list



$powershellSnapin = “Microsoft.Sharepoint.Powershell”
if ((Get-PSSnapin -Name $powershellSnapin -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin $powershellSnapin
}

try
    {
        $web= Get-SPWeb "url"  #url
       $webpartmanager = $web.GetLimitedWebPartManager("/Lists/1Contracts/AllItems.aspx", [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared) #Get the webpart manager class

        for($i=0;$i -lt $webpartmanager.WebParts.Count;$i++)  
            {
                if($webpartmanager.WebParts[$i].title -eq "1Contracts")   #list title
                    {  
                        $wp=$webpartmanager.WebParts[$i]; 
                        #$wp.ChromeType="TitleAndBorder"; #If you want to change ChromeType,Uncomment #.  
                        
                        $wp.View.Toolbar = "AllItems" #Getting view
                        [xml]$x = $wp.XmlDefinition
                        $x.View.Toolbar.Type = "None" # or Standard, Full, Freeform #Toolbar types
                        $wp.View.SetViewXml($x.view.OuterXml)
                        $wp.View.Update()

                        $webpartmanager.SaveChanges($wp);  

                        break; 
                    }
    
            }
 
       $web.Dispose(); 
  }
  catch
    {
        Write-Host  Error  :  $_.exception
    }


Wednesday, 4 November 2015

SQL ROW_NUMBER OVER AND PARTITION BY

Table Name: myTable
Columns:

-->roll_no
-->classId
-->location

SQL Statements

--Get the count of rows based on columns

  SELECT *, ROW_NUMBER()OVER(PARTITION BY roll_no  ORDER BY subject DESC) rowCnt
    FROM myTable order by rowCnt desc
 
--Get the count of rows based on columns using where clause

 SELECT *, ROW_NUMBER()OVER(PARTITION BY roll_no  ORDER BY subject DESC) rowCnt
    FROM myTable
    where myTable.roll_no='1001'
 
--Query sub query data based on where clause  

    SELECT rid FROM(
 SELECT *, ROW_NUMBER()OVER(PARTITION BY roll_no  ORDER BY subject DESC) rowCnt
    FROM myTable
    where myTable.roll_no='1001'
)X WHERE classId= 7 and upper(location) != 'USA' and rowCnt = 1

Tuesday, 3 November 2015

Create ListView using SharePoint PowerShell script



#Passing My Site Url
param($serverUrl)

#Begin arguments validation

if($serverUrl -eq $null)
{
$argErr = $true
}

if($argErr)
{
Write-Host
Write-Host -ForegroundColor Red "One or more parameters missing or invalid. Please see the usage and give the proper parameters"
Write-Host
Write-Host "Usage: Creating List View  messages"
Write-Host
   
    exit
}

try

{

$web = Get-SPWeb -Identity $serverUrl

Write-host
Write-host  "------Getting  List-----"
Write-host

$list = $web.Lists["Demo Ticket"]


Write-host
Write-host  "------  Making Query -----"
Write-host

$ViewName =  "Demoview" #My View Name
     
        $Query = "<Where><Eq><FieldRef Name='AssignedTo'/><Value Type='Integer'><UserID /></Value></Eq></Where>"

Write-host
Write-host  "------Getting Fields for View-----"
Write-host

$fields = $list.Views["All Items"].ViewFields.ToStringCollection()

$viewRowLimit = 50   #Row Limit
$viewPaged = $true #Paged property
$viewDefaultView = $false   #DefaultView property

Write-host
Write-host  "------Adding View  to list-----"
Write-host

$result = $list.Views.Add($ViewName, $fields, $Query, $viewRowLimit, $viewPaged, $viewDefaultView)

Write-host
Write-host  "---- Updating list -----"
Write-host

$list.Update()

Write-host
Write-host  "----- Successfully Added View to  List -Demo View  -----"
Write-host

$web.Update()
}
catch [System.SystemException]
{
  write-host "Execution stopped due to: "+$_.Message -foregroundcolor Red
}




Monday, 26 October 2015

Aras Innovator promote item

1.Part has created. (With state as Preliminary)
2.Promote the item using AML.
<AML>
  <Item type="Part" action="promoteItem" where="[PART].item_number='test133' and [PART].is_current='1' and [PART].state='preliminary'">
     <state>Released</state>
  </Item>
</AML>

Tuesday, 13 October 2015

File upload error for Type:Part Number:P001 Name: Rev:A-1 FileName:test.docx ActualFileName:C:\test.docx Error: Database Name Or Database Description Is Wrong.(Check your request and server configuration file)

Error: File upload error for Type:Part Number:P001 Name: Rev:A-1 FileName:test.docx ActualFileName:C:\test.docx Error: Database Name Or Database Description Is Wrong.(Check your request and server configuration file)


Root cause:
Your vault server name is wrong.

Solution:
Go to aras web ui.
AdministrationFile handlingVault
Search -->Default
Check the value.
Vault URL, should your right target server vault url.

How can you get exact url.

Go to Aras innovator SQL Server.
SELECT * FROM [innovator].[VAULT]

Copy [VAULT_URL_PATTERN] value
Update in innovator we ui, go to AdministrationFile handlingVault Search Default

Now try, your problem should be resolve.

Wednesday, 7 October 2015

Thursday, 1 October 2015

Error : 'SOAP-ENV' is an undeclared prefix. Line 1, position 2.

Error : 'SOAP-ENV' is an undeclared prefix. Line 1, position 2.
Solution:
Innovator is not allowing to login, check the Innovator URL, User ID, Password.

Wednesday, 30 September 2015

how to remove empty line when reading text file using C#



IEnumerable<string> lines = File.ReadLines().Where(line => line != "");

or

List<string> lines = File.ReadLines().Where(line => line != "").ToList();

Sunday, 20 September 2015

Not able to connect Integration Services through SSMS


Solution:
To grant access to the Integration Services service

Run Dcomcnfg.exe. Dcomcnfg.exe provides a user interface for modifying certain settings in the registry.
In the Component Services dialog, expand the Component Services > Computers > My Computer > DCOM Config node.
Right-click Microsoft SQL Server Integration Services 11.0, and then click Properties.
On the Security tab, click Edit in the Launch and Activation Permissions area.
Add users and assign appropriate permissions, and then click Ok.
Repeat steps 4 - 5 for Access Permissions.
Restart SQL Server Management Studio.
Restart the Integration Services Service.

Friday, 18 September 2015

Aras Innovator create item using IOM Code

Open Aras server.
Get url of Aras Innovator from C:\Program Files (x86)\Aras\Innovator\VaultServerConfig.xml
<AppServerURL>:
Get Databased name from C:\Program Files (x86)\Aras\Innovator\InnovatorServerConfig.xml
DB-Connection
Now get User ID/Password.
Copy IOM dll from: C:\Program Files (x86)\Aras\Innovator\Innovator\Server\bin

Create a class library.
Add IOM.dll as reference.
Add below code to create a part in Aras Innovator.

   String url = "http://localhost/InnovatorServer/Server/InnovatorServer.aspx";
                        String objBb = "MyDb";
                        String loginName = "admin";
                        String pwd = "innovator";
                        HttpServerConnection conn = IomFactory.CreateHttpServerConnection(url, objBb, loginName, pwd);
                        Item login_result = conn.Login();
                        if (login_result.isError())
                            throw new Exception("Login failed");
                        Innovator myInnovator = login_result.getInnovator();
                        var partItem = myInnovator.newItem("Part", "add");
                        //var partItem = myInnovator.newItem("Part", "merge");

                        partItem.setProperty("item_number", strItemNumber);
                        partItem.setProperty("description", strObjectName);
                        var resultItem = partItem.apply();
                        Console.WriteLine("resultItem " + resultItem);
                        conn.Logout();

                        Console.Read();

Aras Innovator Create a class library

Create a class library.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyClass
{
    public class DemoClass
    {

        public string strMy = "";
        public DemoClass(string s)
        {
            this.strMy = s;
        }

        public string GetMethod()
        {
            return "Hell world" + strMy;
        }

    }
}
Note: your class should be public.
Build
Copy the dll.
Go to Aras Server.
Paste your dll in this path: C:\Program Files (x86)\Aras\Innovator\Innovator\Server\bin
Now go to this path and open method-config.xml file.
C:\Program Files (x86)\Aras\Innovator\Innovator\Server\method-config.xml
In the xml file, go to this tag:
<MethodConfig> <ReferencedAssemblies>
Add new tag similar to : <name>$(binpath)/Conversion.Base.dll</name>
Now change dll name: ex: <name>$(binpath)/MyClass.dll</name>
Now in the same file, scroll down.
You will see name space section, where all .net name spaces are added.
Add your dll name space.
Ex: using MyClass;
Do for all references.
Save.
Now Open Aras Innovator from web UI.
Go to Administration

Methods
Right click: New Method
Enter method name,
Select Server-side
Select C#

Now use below IOM code.
IOM Code.
MyClass obj=new MyClass ("Welcome from aras");
Innovator innovator = this.getInnovator();
return innovator.newResult( obj.GetMethod());
Check the syntax.


Run the code using.
Actions-->Run Server Method.
You will get output.
How to set above code to an Item?
First create an Action.
In the action-->It will ask name, enter name.
It will ask method, Enter method name which you have created in earlier.
Save.
Now go to item.
Search for any item ex: “Parts”
Now open part.
Unlock
Under actions, add new action.
Search for your action which you have created.
Save.
Now go to Design
Parts
Search for any part.
Right click on the part you will see your action name.
Click it.




Thursday, 3 September 2015

How to delete Manufacturer Part

Go to Sourcing
Manufacturer Part
Search for "Manufacturer Part"
Delete
If you are getting any error then Manufacturer Part has used in some parts.

Right click on "Manufacturer Part", click "Where Used"
You will get all part numbers..
Now go to parts
Search for "part" which used Manufacturer Part
Open part
Click on elated changes
Click on ECO
Open ECO
Lock ECO
Under Affected Item
Select all Affected Items
delete
Save
Now go to Manufacturer Part
Delete




Tuesday, 1 September 2015

Aras innovator The underlying connection was closed: An unexpected error occurred on a send

Error:
aras innovator The underlying connection was closed: An unexpected error occurred on a send

<faultcode>999</faultcode>

Solution:
Case 1:
Comment below line.
//if(System.Diagnostics.Debugger.Launch()) System.Diagnostics.Debugger.Break();  //enable/disable the debugger as required

Since you have added debugger, IIS is not responding. So stop debugger.

Case 2: Your AML is takeing more time to execute, IIS is not responding.
So increase IIS Connection Time-out
Open IIS
Expand Sites
Default Web Site-->Right click "Manage website"-->"Advanced Settings"-->Limits-->
Connection Time-out(seconds)
Change to 600 or 1200

Ideally 3 places you will see time out error in Aras

11.Client timeout – If you have developed any application using C#, then you have to increase the timeout value.
     Innovator innovator
     HttpServerConnection connection = IomFactory.CreateHttpServerConnection(“...”, “…”, “…”, “…”);
            connection.Timeout = 10000000;
            ServicePointManager.MaxServicePointIdleTime = 10000000;
            ServicePointManager.MaxServicePoints = 4;
            Item loginOItem = connection.Login();

22. IIS timeout -If you are using any AML code, then you may get timeout error, for that increasing website from 120 to 1800
·         Open IIS
·         Expand Sites
·         Default Web Site-->Right click "Manage website"-->"Advanced Settings"-->Limits-->
·         Connection Time-out(seconds)
·         Change to 600 or 1200
33.SQL timeoutIf you are using any AML code or SQL, then you may get timeout error , for that increasing from 600 to 3000
·         Login to SQL server management studio
·         Connect to sql server
·         Right click on sql serveràPropertiesàConnections
·         Remote query timeout give 600 or 1200

Note: It's always recommended to set back IIS and SQL timeout values as is, after completion of your task




Wednesday, 26 August 2015

Column ' ' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value;




You are expecting one  column in select , but you are not adding at GROUP BY 

Saturday, 22 August 2015

How to protect from cross site scripting attacks?"


The easiest way to protect yourself as a user is to only follow links from the main website you wish to view. If you visit one website and it links to CNN for example, instead of clicking on it visit CNN's main site and use its search engine to find the content. This will probably eliminate ninety percent of the problem. Sometimes XSS can be executed automatically when you open an email, email attachment, read a guestbook, or bulletin board post. If you plan on opening an email, or reading a post on a public board from a person you don't know BE CAREFUL. One of the best ways to protect yourself is to turn off Javascript in your browser settings. In IE turn your security settings to high. This can prevent cookie theft, and in general is a safer thing to do.

"Does encryption protect me?"

  Websites that use SSL (https) are in no way more protected than websites that are not encrypted. The web applications work the same way as before, except the attack is taking place in an encrypted connection. People often think that because they see the lock on their browser it means everything is secure. This just isn't the case.

A few facts about cross-site scripting attacks that you should be aware of are:

Every month roughly 10-25 XSS holes are found in commercial products and advisories are published explaining the threat.
Websites that use SSL (https) are in no way more protected than websites that are not encrypted. The web applications work the same way as before, except the attack is taking place in an encrypted connection.
XSS attacks are generally invisible to the victim.
All Web servers, application servers, and Web application environments are susceptible to cross-site scripting.


Risks Associated with Cross-Site Scripting
(What type of damages will happens because of XSS)

  • User accounts being stolen through session hijacking (stealing cookies) or through the theft of username and password combinations
  • The ability for attackers to track your visitors web browsing behavior infringing on their privacy
  • Abuse of credentials and trust
  • Keystroke logging of your site’s visitors
  • Misuse of server and bandwidth resources
  • The ability for attackers to exploit your visitor’s browser
  • Data theft
  • Web site defacement and vandalism
  • Link injections
  • Content theft

Tuesday, 18 August 2015

How to install Mozilla Firefox 31.0esr


To view all versions...
https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
To install 31.0esr
https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/31.0esr/
Click on Win32
https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/31.0esr/win32/
Click on en-US
https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/31.0esr/win32/en-US/
Click on
Firefox Setup 31.0esr.exe

Now you can install Mozilla Firefox 31.0esr

Friday, 14 August 2015

Search for a keyword in multiple files

Open command prompt
Go to folder path where your files are there.
c:\abc>
Type below command.

 forfiles /D -1 |findstr /I /S /P /M SearchKeyword * >c:\temp\results.txt

Now you will see result file names under ::\temp\results.txt

Ex: c:\abc> forfiles /D -1 |findstr /I /S /P /M redmond * >c:\temp\results.txt

Thursday, 13 August 2015

Notepad++ How to get new line

Notepad++
How to get new line
Find and replace Ex:Find | and replace with \r\n
Select Extended
Click Replace All.


Monday, 10 August 2015

event viewer custom view

 private static void WriteToEvent(string source, string message, EventLogEntryType evtType, int id)
        {
            //Folder Name under Applications and Services Logs
            System.Diagnostics.EventLog objEventLog = new System.Diagnostics.EventLog(source);
            objEventLog.Source = source;
            objEventLog.WriteEntry(message, evtType, id);
        }

  WriteToEvent("MySource", "My Error  ", EventLogEntryType.Error, 1110);


Tuesday, 28 July 2015

Move System Databases

Open SQL
Select DB Name
Right click on DB
Select properties
Click on Files
You will find where .mdf .ldf files are located in the server.
Now you need to move this files in to another drive.
Step1:
Select DB
Right click -->Tasks-->Detach
Check Drop, Update check boxes in the new window
Ok
Now you have Detached DBs from SQL
Step 2:
Move .mdf .ldf files to another location.
Cut from current location and paste another location.Ex: form c to D
Step 3:
Attach the DB
Right click on database
Click Attach
Select .mdf file from your new location
Ok

Done..

Wednesday, 22 July 2015

How To Get Compare Plugin Back Into Notepad++


Go to notepad++ plugins from below site
http://sourceforge.net/project/showfiles.php?group_id=189927
Download ComparePlugin from below site
http://sourceforge.net/projects/npp-plugins/files/ComparePlugin/
Inside the downloaded zip file, you will find the ComparePlugin.dll. Unzip and place this into your Notepad++ plugins directory (which is usually at C:\Program Files (x86)\Notepad++\plugins)

Now open 2 files which you want to compare using notepad++
In the Notepad++ top menu, you will see Plugins
Click Plugins-->Compare-->Compare

That's it...:)


XML tools plugin

https://sourceforge.net/projects/npp-plugins/files/XML%20Tools/Xml%20Tools%202.4.4%20Unicode/Source%20XML%20Tools%202.4.4%20Unicode.zip/download

Monday, 20 July 2015

SQL Server Management Studio Local path

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft SQL Server 2008 R2\SQL Server Management Studio

Monday, 6 July 2015

One of the BEST msg I have come across:Worth reading-


A group of friends visited their old university professor.
Conversation soon turned to complaints about
'STRESS' & 'TENSION' in Life.
Professor offered them Coffee & returned from kitchen with Coffee in different kinds of cups !!!
(Glass Cups, Crystal Cups, Shining Ones, Some Plain Looking, Some Ordinary & Some Expensive Ones......)
When all of them had a Cup in Hand,
the professor said:-
"If you noticed-
all the Nice Looking & Expensive Cups are taken up,
leaving behind the ordinary ones !!
Everyone of you wanted the Best CUPS,
&
that is the source of your STRESS & TENSION !!
What you really wanted was
"Coffee", not the "Cup" !
But you still went for the Best Cup.
If Life is Coffee ;
Then Jobs, Money, Status & Love etc. are the Cups !!!
They are just TOOLS to hold and contain Life.
Please Don't Let the CUPS Drive you !!
Enjoy the COFFEE ......!!!
What is life ?
They say its from B to D...from Birthday to Death..But what's between B and D?
Its a " C " Choice ...
Our life is a matter of choices...
Live well and it will never go wrong....

Wednesday, 1 July 2015

.Net how to prevent client sessions

Ans) Change connection string in web config
restart the w3svc service Or IIS 

Tuesday, 30 June 2015

Preserving Session State in Network Load Balancing Web Server Clusters

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/77cb4318-75f8-4310-a05f-3605b5768007.mspx?mfr=true

How to use SQL-SERVER profiler for database tuning



http://netwovenblogs.com/2014/04/15/how-to-use-sql-server-profiler-for-database-tuning/

in order to run trace against sql server you must be a member of sysadmin



Solution:
Provide ALTER TRACE permission for the particular user

USE master
GO
GRANT ALTER TRACE TO user1
GO

After your work you can REVOKE the access

USE master
GO
REVOKE ALTER TRACE FROM user1
GO


Another way to grant rights, login with sysadmin login then open SSMS
~~ Open Security then Logins
~~ Right click on the login name and click Properties
~~ Securables tab
~~ Click Search to Select the instance that required permissions
~~ Under Explicit tab
~~ Select the check box ALTER trace permission and Click OK.

Monday, 29 June 2015

Aras Innovator how to check attribute

Open Aras Web UI
Go to Administration--> System Events -->ItemTypes
Search for type of item: Ex: *part* or *doc* or *change*
You will get search result
Now double click it.
You will new window--> Under Properties
You can find all attributes, with name and data type  and data source

Or you can go to DB, and check for below query..
select * from innovator.PART

It should give all Properties names....



Friday, 26 June 2015

C# Task Parallel Library

in the above scenario TPL is working fine, but look at below scenario..I use Foreach If you have less data, TPL will not work good. Never use this type of syntax for xml read, it will not work.. Parallel.ForEach(AllXMLNodes, element => { //do something }); https://www.youtube.com/watch?v=No7QqSc5cl8

How to change the branch in git


Open Visual Studio
Connect to team projects
Provide TFS Details and connect.
Under "Connect to team projects" you will see Local Git Repositories
You will see "Clone"
Click Clone
Now enter TFS Code path and local path to get the files from TFS
Click Clone
Now you will get all files to local

Now Under "Connect to team projects" you will see Local Git Repositories
You will see some name with tree structure icon.
Double click that, it will give all solutions under TFS.

Now click on Home icon
Click on Branches
You will see Actions
Expand Actions -->Click on Open Command Prompt
You will see one command prompt
Type below command to set one existing branch
git checkout MyBranch

Now click on Home icon
Click on "Unsynced Commits"
Click Sync
You will get all files from "MyBranch"

Thursday, 25 June 2015

How do I rename a task in Task Scheduled on Windows Server 2008 R2

Ans: Don't worry you can rename it...

First you can check your tasks under this path
\%SystemRoot%\Tasks
Ex: C:\Windows\System32\Tasks

Or
Open Task Scheduler from control panel
Expand Task Scheduler
Click on Task Scheduler Library
You will see your task

If you want to rename the Task Name, you can't do for existing, you need to import existing task, while importing it will ask name, at that time you can change the name.
Go to this path:C:\Windows\System32\Tasks
You will find your task.
Now go to Task Scheduler Library
In the main canvas, (Middle pane) you will see your old task..
Now in the same canvas right click
Select "Import task.."
Browse this path: C:\Windows\System32\Tasks  (Change to All files (*.*))
Now select your old task.
Ok
You will Create Task Window, with Name as old name, now change the name.
Ok
Now you will see same task with different name.

Go to this path:C:\Windows\System32\Tasks delete old task.

If you want to change any other properties...
Select yor task , in the right side you can see Properties (Or Right click the task-->Properties)
Click on Properties
You will get new window
If you want to change the user account, click on "Change User or Group..."
Now you can enter new user account.

If you want to change the exe path.
Clcik on Actions in the same window (Which opened when you click on Properties)
Select Action
Click Edit
Now you can change the exe path

Monday, 22 June 2015

Tuesday, 19 May 2015

error occurred in deployment step recycle iis application pool cannot connect to the sharepoint site remote site

1st : Restart IIS:
iisreset

2nd: Open the web site and check wither it is opening in the browser or not. If it’s not work then you should check the SharePoint servers are running.

3rd: If the web site is open successfully then you should Restart visual studio.

4th Option, if the site is open successfully and you had Restarted visual studio. then you should check if the  current user on the web content database is owner.  If not then add the current user to the web content database with owner role.
Open WSS_Content
Security
Users
Add new user

5th
Restart the SharePoint 2010 User Code Host service resolved the issue. :SPUserCodeV4

restart-service SPUserCodeV4



SQL Server 2016, an intelligent platform for a mobile first, cloud first world

Microsoft, announced SQL Server 2016, an intelligent platform for a mobile first, cloud first world.

Top capabilities for the release include:

Always Encrypted - a new capability that protects data at rest and in motion



Stretch Database - new technology that lets you dynamically stretch your warm and cold transactional data to Microsoft Azure



Enhancements to in-memory technologies and new in-database analytics with R integration.



Built-in Advanced Analytics, PolyBase and Mobile BI



Additional capabilities in SQL Server 2016 include:

  • Additional security enhancements for Row-level Security and Dynamic Data Masking to round out our security investments with Always Encrypted.
  • Improvements to AlwaysOn for more robust availability and disaster recovery with multiple synchronous replicas and secondary load balancing.
  • Native JSON support to offer better performance and support for your many types of your data.
  • SQL Server Enterprise Information Management (EIM) tools and Analysis Services get an upgrade in performance, usability and scalability.
  • Faster hybrid backups, high availability and disaster recovery scenarios to backup and restore your on-premises databases to Azure and place your SQL Server AlwaysOn secondaries in Azure.

In addition, there are many more capabilities coming with SQL Server 2016 that deliver mission critical performance, deeper insights on your data and allow you to reap the benefits of hyper-scale cloud.

Saturday, 16 May 2015

Debug Aras Innovator server and client methods

Debugging Server Method

If you want to debug your custom methods or any OOTB methods,
Go to Aras UI
Open method from (Administration-->System Events-->Methods-->)
Search for method name
Open it
Lock
Now go to code..
Inside Function Main() as Item

or go to Main() function

Add below code..

System.Diagnostics.Debugger.Launch()
System.Diagnostics.Debugger.Break()

Compile, Save

Now go to Aras UI, do any action which trigger your method.
Now go to Aras Server.
You will see one prompt

I the prompt-->Click on Yes, debug w3wp.exe
It will as conformation
Then select visual studio..


Debugging Client Method


1.      As per “_Students Masters Developers 11.pdf”
Add the statement “debugger;” at the point you want to set as breakpoint to invoke the debugger. The following description is applied when ARAS instance is invoked in internet explorer.
Deselect Disable Script Debugging in Advanced Options of Internet Explorer. Select Display a notification about every script error in Advanced Options of Internet Explorer



Client Debugging with Visual Studio 2010

To debug client JavaScript methods with VS 2010 (or greater) requires additional setup. Use the following steps to debug a client program:
1.       Start Aras Innovator in Internet Explorer but do not logon to the system.
2.       Start Visual Studio 2010.
3.       From the VS 2010 main menu, select "Tools" and "Attach to Process"
4.       Locate the "iexplore.exe" process with the "Title" that matches the Aras Innovator instance.
5.       Select the process and click "Attach".
6.       Return to the login screen for Aras Innovator and press F5 to refresh the page.
7.       Log in to Aras Innovator
8.       Run the Method and the application will switch to the "Microsoft Visual Studio .NET 2010" debugger and break on the debugger; statement in a client JavaScript method.



Thursday, 14 May 2015

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'



Add below tag in web.config:
    <identity impersonate="false" />

Excel not able to see Developer option



Open Excel
File-->Options
You will get new window
Click on "Customize Ribbon"
You will get new window
In the right side you will see "Developer"
Check that
Now you will see Developer option in Excel.

Tuesday, 12 May 2015

Monday, 11 May 2015

Error: system.outofmemoryexception. Easy ways to increase the memory available to your program



Open Your project
Open Solution explorer
Right click on project
Select Properties
Click on Build Event
You will see: Post-build event command  line:

Add below lines of script inside that box..
call "$(DevEnvDir)..\..\vc\vcvarsall.bat" x86
"$(DevEnvDir)..\..\vc\bin\EditBin.exe" "$(TargetPath)"  /LARGEADDRESSAWARE


Now click on "Debug"
Under Enable debuggers
check: "Enable Visual studio Hosting Process"
Save

Now run your project, you will not see system.outofmemoryexception error



Ref:http://blogs.msdn.com/b/calvin_hsia/archive/2010/09/27/10068359.aspx

Tuesday, 5 May 2015

Powershell call exe using batch file

Copy exe in to a folder: Ex:C:\Deploy\MyProject\
My exe name: MyProject.exe

C:\Deploy\MyProject\MyProject.exe

Now Write PS1 file code as: My.PS1

My.PS1
--------------
Param
(
[string]$pathofexe = $null
)

$pathofexe= $pathofexe
& $pathofexe

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

Save above PS1 in folder C:\Deploy\PS

Now write .bat file

My.bat

------------------------
@Set pathofexe=%~dp0MyProject\MyProject.exe

PowerShell.exe Set-ExecutionPolicy RemoteSigned; %~dp0PS\My.PS1 -pathofexe %pathofexe%

PAUSE
------------------------

Save above .bat file in folder C:\Deploy

Now your file structure:
MyProject.Exe -C:\Deploy\MyProject\MyProject.exe
My.PS1- C:\Deploy\PS\My.PS1
My.bat - C:\Deploy\My.bat

Now run My.bat as administrator


Note: If you get any error while running above try with: Set-ExecutionPolicy unrestricted,

PowerShell.exe Set-ExecutionPolicy unrestricted; %~dp0PS\My.PS1 -pathofexe %pathofexe%




Aras innovator low performance

Aras innovator performance is not good

Root cause 1 :Check are you closing Innovator connection or not.
If not close connection like this..

HttpServerConnection conn =
IomFactory.CreateHttpServerConnection( url, db, user, password );

Item login_result = conn.Login();
if( login_result.isError() )
throw new Exception( “Login failed” );
Innovator inn = IomFactory.CreateInnovator( conn );


To close connection
if(inn!=null)
{
conn.Logout();
}

You can find number of Active connections which are running in Innovator server using below steps..
Open Innovator server UI
Login ad Admin
In the top ribbon
Click on Tools
Admin
Licenses
License Manager

You will get new window
Click > green Search Icon
Now you will see all active connections..

If you want to close all connections
Go to Windows Services (services.msc)

Restart (W3SVC) : World Wide Web Publishing Service (IIS)
Now if  you check the connection count in Innovator, it should be 1

Other Root cause(s) : There would be multiple reasons for Aras innovator low performance, like your logic which has implemented to do some functionality or because of multiple conditions (like if and for loops) or because of server configuration or because of network



Monday, 4 May 2015

powershell write to log file

Batch File
My,bat

--------------------------------------
@echo off
SET Today=%date:~4,2%%date:~7,2%%date:~10,4%%time:~0,2%%time:~3,2%%time:~6,5%.log
echo %today%
echo
(
PowerShell.exe Set-ExecutionPolicy RemoteSigned; "C:\my.PS1"
)
echo save all log in to file- start
echo
echo save all log in to file - end
PowerShell.exe -Command "& {C:\my.PS1}" > C:\%today%

echo save all log in to file - end
echo
PAUSE


-------------------------------------------
PowereShell
my.PS1
----------------------------------------------
Param
(
[string]$fileName = $(get-date -f yyyy-MM-dd-hh-mm-ss)
)
write-host "Hello" `n
write-host "Start print date" `n
write-host $fileName".log" `n
write-host "End print date" `n


Another way of saving log data in to a file.
------------------------------------------

Batch File
My,bat

--------------------------------------
@echo off
SET Today=%date:~4,2%%date:~7,2%%date:~10,4%%time:~0,2%%time:~3,2%%time:~6,5%.log
echo %today%
echo
(
PowerShell.exe Set-ExecutionPolicy RemoteSigned; "C:\my.PS1"
)
echo save all log in to file- start
echo
echo save all log in to file - end

> C:\%today%

echo save all log in to file - end
echo
PAUSE


-------------------------------------------
PowereShell
my.PS1
----------------------------------------------
Param
(
[string]$fileName = $(get-date -f yyyy-MM-dd-hh-mm-ss)
)
write-host "Hello" `n
write-host "Start print date" `n
write-host $fileName".log" `n
write-host "End print date" `n



powershell create file and write to it

Param
(
[string]$fileName = $(get-date -f yyyy-MM-dd-hh-mm-ss)
)

write-host $fileName".txt"

create database permission denied in database 'master'


First logout from SQL with current user
Login as SQL Administrator
Expand Server
Expand Security
Expand Logins
Now select the account name which you are getting create database permission denied in database 'master' error
Right click
Select Properties
You will see new window
Click on Server Roles
Click on sysadmin
Ok
Now you login as account name which you are getting

C# Math.Ceiling

  try
            {
                string ss = "1.2677";            
                int d = (int)Math.Ceiling(float.Parse(ss));

                Response.Write(d);

                double[] values = { 7.03, 7.64, 0.12, -0.12, -7.1, -7.6 };
                Console.WriteLine("  Value          Ceiling          Floor\n");
                foreach (double value in values)
                    Console.WriteLine("{0,7} {1,16} {2,14}",
                                      value, Math.Ceiling(value), Math.Floor(value));

            }
            catch (Exception)
            {

                throw;
            }

Saturday, 2 May 2015

1 uncommitted change would be overwritten by merge

If you have  any excluded changes, Undo and Pull, It will resolve your problem.

XML add root element

XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.NewLineOnAttributes = true;
settings.OmitXmlDeclaration = true;

string strBody="<A>1</A><B>2</B>";
string strXML = "<Root>" + strBody + "</Root>";
XDocument xmlres = XDocument.Parse(strXML);
XmlWriter wrt = XmlWriter.Create("c:\\a.xml", settings);
xmlres.Save( wrt);
wrt.Close();

xml remove root node c#


TextReader txtIn = new StringReader("<Root><A>Content</A></Root>");
XDocument xIn = XDocument.Load(txtIn);
XElement xOut = xIn.Root.Elements().First();

 xOut.ToString();
Outpt: <A>Content</A>

Thursday, 30 April 2015

System.Net.WebException: The operation has timed out

I have modified below values in my Web.config, it has resolved my issue.

  <httpRuntime maxRequestLength="60000000" executionTimeout="60000000" />

 <requestFiltering>
       <requestLimits maxAllowedContentLength="60000000" />
     </requestFiltering>

Then you need to change applicationHost.config

open the %windir%\System32\inetsrv\config\applicationHost.config file

Change this:

From
<section name="requestFiltering" overrideModeDefault="Deny" />

To

<section name="requestFiltering" overrideModeDefault="Allow" />

If still you are facing error..try this..

HttpServerConnection objConn;
objConn.Timeout = 60000000;
ServicePointManager.MaxServicePointIdleTime = 60000000;

Ref:http://ajaxuploader.com/large-file-upload-iis-debug.htm

Tuesday, 28 April 2015

aras innovator System.Net.WebException: The operation has timed out

Case 1:
If you are using StreamReader or any request objects, you need to close it.

  HttpWebRequest r = WebRequest.Create("URL");
        HttpWebResponse w = r.GetResponse()

Close that objects..
 w.Close(); // Close connection  here.

Case 2: You are running your code from remote system, which is giving time out error..

Case 3: Your AML might be very big, split your AML in to 2 and try it..
Case 4: Your AML might be very big, split your AML in to 2 and try it and try to get only properties which are required in the select, if you don't specify the properties, aras will get all properties which will give time out error




Windows will report error #1053



Srvany is a utility developed by Microsoft that can start almost any regular, non-service application as a Windows Service.

Since a Windows Service must be specially constructed to interface with the operating system (to allow Windows to start, stop or pause it on demand), a regular application without this interface will not function properly as a Service. To solve the problem, Microsoft developed Srvany - an "adapter" (or "wrapper") that can accept the Windows Service commands and translate those into actions that a regular executable can understand.

Like any good adapter, Srvany is installed in between Windows and the application and handles all interaction between them. For example, when Windows says "Start the service", Srvany intercepts the request and starts the application as if you had double-clicked on it yourself.

Srvany was developed in the late 1990's for Windows NT and remains mostly unchanged to this day. It is available as part of the Windows Server 2003 Resource Kit Tools package.

Ref: http://www.coretechnologies.com/WindowsServices/FAQ.html#WhatIsSrvany