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>