Wednesday, November 23, 2011

Reverse percentage calculation?

How to find X, which give you 115000 when 15% is deducted(Reverse Percentage Calculation)?

eg ax + bx = c your eqution is
ax +b = c
where a , b and c are numerical values and x is the unknown!

For the time being we can phrase the equation as

x - 15%x = 115000

then your answer would be

x(1 - 0.15) = 115000 (factorizing x)

x (0.85) = 115000 then dividing by 0.85

x = 135294.1176

substitute for x and you will find this is a correct answer!

135294.1176 - 0.15(135294.1176) = 115000


http://uk.answers.yahoo.com/question/index?qid=20070420010452AAsnX7C

Sunday, November 13, 2011

How to bring jQuery Intellisense in VS 2008

First run the hopfix VS90SP1-KB958502-x86 for VS 2008,you can find the hot fix at


http://archive.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736

Open Visual Studio 2008 > File > New > Website > Choose ‘ASP.NET 3.5 website’ from the templates > Choose your language (C# or VB) > Enter the location > Ok. In the Solution Explorer, right click your project > New Folder > rename the folder as ‘Scripts’

Right click the Scripts folder > Add Existing Item > Browse to the path where you downloaded the jQuery library (jquery-1.2.6-vsdoc.js) and the intellisense documentation (jquery-1.2.6-vsdoc.js) > Select the files and click Add.

Now drag and drop the jquery-1.2.6.js file from the Solution Explorer on to your page to create a reference

You can dounload Jquerry intellisense documentation for Vs2008 (jquery-1.2.6-vsdoc.js) at
http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.6-vsdoc.js

You can dounload Jquerry jQuery library (jquery-1.2.6-vsdoc.js) at
http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.6.js

Note: Since you have applied the hotfix, you do not have to manually add a reference to the jquery-1.2.6-vsdoc.js file in your page. Once the reference to the runtime library has been added, Visual Studio automatically searches for the ‘vsdoc’ file and loads it. You just need to keep both the runtime library and the documentation file next to each other

To test intellisense, add a  script block and key in ‘$(‘. 


More infomrtaion regarding the same can be found at the below loaction

http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx
or
http://www.dotnetcurry.com/ShowArticle.aspx?ID=231

Saturday, September 3, 2011

How to select an option in dropdown by its index using JavaScript?

The below code will help you to select an option in a dropdown by its index


You can find more examples of the same in the below website

http://www.mredkj.com/tutorials/tutorial003.html

How to show scroll bars for a label in C# .net?

This functionality can be achieved by using a text box or a rich text box instead of a label


If your are using a Text box then you can achieve the same by below code.


textBox1.AppendText( "Hello World \r\n");

In the above code \r\n is used to print the “Hello World “text in new line each time it is added to the textbox control.

If your are using a Rich Text box then you can archive the same by below code. 

richTextBox1.Text = richTextBox1.Text + "Hellow World \r\n";
richTextBox1.HideSelection = false;
richTextBox1.Focus();
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.ScrollToCaret();

In the above code \r\n is used to print the “Hello World “text in new line each time it is added to the rich textbox control.

Tuesday, August 30, 2011

How to rename the logical name of a database in SQL 2008?

How to rename the logical name of a database in SQL 2008?


The blow TSQL will rename the logical name of your  databases


ALTER DATABASE [yourdatabses]
MODIFY FILE (NAME = 'oldlogicalname', NEWNAME = 'newloggicalname')


In the above example [yourdatabses] can be replaced with your databases name,’oldlogicalname' can be replaced with the existing logical name of your database and 'newloggicalname' name can be replaced with the new logical name for your databases.

Reference
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=54300

How to see the list of files in a SQL server backup file?

How to see the list of files in a SQL server backup file?


Today I was coding one application which will help us to restore and take back of our application’s databases.While coding the application I came across a situation, where I need to now the logical file name of the mdf and ldf files in the backup file.I googled a loot and finally I found a solution which I thought of sharing here for other who needs the same.

The TSQL command below will show the show the back up type and other details of the file.


RESTORE HEADERONLY FROM DISK='E:\xxxxxxxxxxxxx'

 
To retrieve the logical files name and other details use the below TSQL

RESTORE FILELISTONLY FROM DISK = 'E:\xxxxxxxxxxxxx' with file=1

Sunday, August 28, 2011

How to get the machine and windows user name of a logged in user in c#?

The below code will help you to find the Logged in windows user

System.Security.Principal.WindowsIdentity.GetCurrent().Name;

For getting the Machine Name you can use the below code.

WindowsIdentity.GetCurrent().Name;