Monday, December 09, 2013

Using extra & with XMLPoke of nAnt

When using XMLPoke on nAnt I used extra amp; when String already contains &

For example

<xmlpoke file="Menu.xml" xpath="//Item[Name[text()='ams']]//ArgumentExpression" value="https://www.myserver.com/Home.aspx?TID={session}&amp;cid={cid}&amp;Username={username}&amp;uiculture={uiculture}" />

I used following extra &amp; as shown below and XMLPoke worked.

<xmlpoke file="Menu.xml" xpath="//Item[Name[text()='ams']]//ArgumentExpression" value="https://www.myserver.com/Home.aspx?TID={session}&amp;amp;cid={cid}&amp;amp;Username={username}&amp;amp;uiculture={uiculture}" />
 

Wednesday, November 20, 2013

Get Installed .NET versions list

In order to know which .NET frameworks being installed, use following command from the Comand Promt

wmic product where "Name like 'Microsoft .Net%'" get Name, Version

Wednesday, August 07, 2013

Get Multiple Services using Single PowerShell Command

In order to get multiple services using single PowerShell command I used following

Get-Service | Where-Object {($_.name -like "FV*") -or ($_.name -like "QESE*")}

Wednesday, December 12, 2012

Clean Redis DB

In order to clean redis database, I used following commnad

redis-cli -p 1216

redis-cli> flushall

Delete all Objects (Images) from Excel Workbook

Select the workbook
Press F5
Click Special
Select Objects
Click OK
Press Delete key from Keyboard

Friday, May 11, 2012

XPATH with namespace

In order to execute XPATH on XML file with namespace, I used following syntax while using nant's xmlpoke command
 

<xmlpoke file="myfile.xml" xpath="/x:Project/x:PropertyGroup/x:ApplicationVersion" value="1234" >
<namespaces>
<namespace prefix="x" uri="http://schemas.microsoft.com/developer/msbuild/2003" />
</namespaces>
</xmlpoke>

Thursday, May 10, 2012

Display batch file output on console and write to file simultaneously

In order to see output of DOS Batch file on console as well as log to file simultaneously, I used following syntax

executeme.bat > C:\log.txt && type C:\log.txt

Thursday, October 06, 2011

Echo without carriage return or line feed

In order to remain on same line (without carriage return or line feed) using echo in DOS batch file, I used the following syntax

echo.|set /p= My text here & echo some other text

Tuesday, July 26, 2011

Install PHP and Apache on Ubuntu server

In order to install PHP and Apache on Ubuntu server, I used the following commands

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo /etc/init.d/apache2 restart

Monday, July 18, 2011

List and Kill tasks from the Windows commandline

In order to get all running tasks from the windows command line I used the following command,

tasklist

In order to kill the task forcefully, I used the following command, where 7084 is the PID if the task.


taskkill /F /PID 7084

Tuesday, June 21, 2011

Bypass SSL security in C# WebClient

If you are using WebClient in C# and getting following error,
"The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."

and you want to bypass the SSL certificate security, just use this code to bypass the security check, before calling client.OpenRead method

ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(
delegate
{
return true;
});

Thursday, April 28, 2011

Halt DOS batch execution on error

In order to halt DOS batch file on error, I used the following syntax

svn up
IF NOT ERRORLEVEL 1 GOTO SVNDONE
ECHO An error occurred with exit code 1 or higher while executing command 'svn up'
GOTO FINAL
:SVNDONE
ECHO SVN Update is successful.

:FINAL
echo DOS batch file execution finished.

Wednesday, March 02, 2011

Auto refresh the webpage using Meta tag

In order to refresh the web page automatically, I put following line in the HTML head tag, which refreshes the web page every 10 seconds

<META HTTP-EQUIV="Refresh" CONTENT="300;">

Wednesday, February 23, 2011

Rename servername in MS-SQL when computer hostname changes.

When you change computer hostname, MS-SQL servername is not automatically updated. In order to update MS-SQL servername I used following SQL commands

sp_dropserver 'oldHostname'
go

sp_addserver 'newHostname',local
go

Now restart your SQL server instance and when follwing command is executed, you will see newHostname appears.

select @@servername as 'Server Name'

or

select * from sys.servers

Wednesday, February 16, 2011

Creating symbolic link in Windows

In order to create new symbolic link in Windows, I used the following command from the command prompt.

mklink /D myLink c:\Software\

where myLink is name of the symbolic link and C:\Software\ is the target path.

Stop and Start IIS7 website

In order to stop and start only specific site using IIS7, I used the following command from command prompt.

%systemroot%\system32\inetsrv\appcmd stop apppool /apppool.name:MySite

%systemroot%\system32\inetsrv\appcmd start apppool /apppool.name:MySite

where MySite is the name of the site which you want to stop and start.

Tuesday, January 25, 2011

Handle JavaScript dialog using WebAii

In order to handle JavaScript dialog using WebAii I used following command

manager.DialogMonitor.AddDialog(new AlertDialog(manager.ActiveBrowser,DialogButton.OK)); // Dialog which clicks on OK button

manager.DialogMonitor.Start();

manager.ActiveBrowser.Actions.Click(Element) // Click on link

Wednesday, January 19, 2011

Test Fixtures in Visual Studio Unit Testing Framework

Today I learned that,

[ClassInitialize()] fixture in VS Test Framework is [TestFixtureSetUp] in NUnit
and
[ClassCleanup()] fixture in VS Test Framework is [TestFixtureTearDown] in NUnit

Tuesday, January 18, 2011

Find silverlight element using XamlPath

In order to find Silverlight element using WebAii by XamlPath expression I used following syntax

FrameworkElement myElement = app.Find.ByExpression(new XamlFindExpression("Name=TabsContainer", "XamlTag=grid", "|", "XamlPath=/radtabcontrol[automationid=Tabs]/grid[0]/raddockpanel[0]/layouttransformcontrol[name=HeaderDockedElement]/grid[name=RootVisual]/contentpresenter[name=ContentPresenter]/grid[0]/raddockpanel[0]/scrollviewer[automationid=ScrollViewerElement]/border[0]/grid[0]/scrollcontentpresenter[name=ScrollContentPresenter]/itemspresenter[0]/tabwrappanel[0]/radtabitem[0]"));

Thursday, December 16, 2010

Search and Replace multi-line text

In order to refactor code I used Text Crawler tool. Very powerful tool where one can search and replace multi-line text