Tuesday, January 19, 2010

Error while attempting to create an windows xp user

“The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements. Check the minimum password length, password complexity and password history requirements”.

This error message means that you are not following the password requirements. But how can you find out what the requirements are?

Follow the instructions below:

            Find out what are the password policy requirements:

-         Start >> Control Panel >> Administrative Tools >> Local Security Policy

o       In Account Policies folder, select Password Policy  and you can see the password requirements.

In this way, you can also change the requirements and reduce or increase the complexity.

 

 

Friday, January 15, 2010

Enabling file and directory name completion

File and directory name completion is not enabled by default. You can enable or disable file name completion for a particular process of the cmd command with /f:{on|off}. You can enable or disable file and directory name completion for all processes of the cmd command on a computer or user logon session by setting the following REG_DWORD values:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD 

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD 

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD 

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD 

To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of a control character for a particular function (for example, 0×9 is TAB and 0×08 is BACKSPACE). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

 

Wednesday, November 25, 2009

exit for in C#

If you wanna use something similar with “exit for”  in Visual Basic, in C# you can just use break.

 

For example:

                        foreach (XmlNode xmlChild in xmlDestNodes.ChildNodes)

                        {

                              if (sDestCode == xmlChild.Attributes["code"].InnerText)

                              {

                                    sDestination = xmlChild.InnerText;

                                    break;

                              }

                        }

 

So easy, isn’t it?

Thursday, November 12, 2009

Error Handling using C#

Try, Catch and Finally

 

Build error – the compiler tells you what line contains a build error and provides useful information

Runtime error – this type can crash your application if not properly handled.

 

Visual C# supports structured exception handling

 

Block Types for error handling

Try – block where the error can occurs

Catch – block where you handle the exception

Finally – block that will be execute after try or catch block will be complete.

 

Try forms:

-          try + one or more catch

-          try + finally – if you omit the catch session, the error will be ignored (= “On error resume next”?)

-          try + one or more catch + finally.

 

 

Exception object - represents errors that occur during application execution.

 

System.Diagnostics – this namespace provides classes that allow you to interact with system processes, event logs and performance counters. Event log, Process and Performance counter are classes from it.

It also provides classes that allow you to debug your application and trace the execution of your code. See Trace and Debug Classes.

 

Debbugging Your Code

Visual C#  throws an exception when a runtime error occurs. If this exception is not handled, the program is finished.

In Visual Studio, breakpoints are saved with the project. You don’t have to reset all your break points each time you open the project.

 

Action That Can be Taken at a Break Point

 

Action

Keystroke

Description

Continue Code Execute

F5

Continues execution at the current break statement

Step Into

F11

Executes the statement at the break point and then stops at the next statement. If the current statement is a function call, F11 enters the function and stops at the first statement in function.

Step Over

F10

Executes the statement at the break point and then stops at the next statement. If the current statement is a function call, the function is run in its entirety; execution stops at the statement following the function call.

Step Out

Shift + F11

Runs all the statements in the current procedure and halts execution at the statement following the one that called the current procedure.

Stop Debugging

Shift + F5

Stops debugging the project and returns to design mode.

 

Only Visual Studio 2008 supports on-the-fly code editing – you can modify code while debugging it.

 

Output window – Visual C# uses the Output window to display various status messages and build errors. The most useful feature of the Output window, is the capability to send data to it from a running application.

 

To print data to the Output window, use the WriteLine() method of the Debug object, like this:

 

System.Diagnostics.Debug.WriteLine(“Results = “ + lngResults);

 

Whatever you place withing the parentheses of the WriteLine() method is what is printed to the Output window. Note that you can print literal text and numbers, variables, or expressions. WriteLine() is most useful in cases where you want to know the value of a variable, but you don’t want to halt code execution using a break point. For instance, suppose you have a number of statements that manipulate a variable. You can sprinkle WriteLine() statements into the code to print the variable’s content at strategic points.

 

Just remember that the Output Window isn’t available to a compiled component; calls to the Debug object are ignored by the compiler when creating distributable components.

 

 

Wednesday, September 16, 2009

How do I rename a column using SQL Server?

It's very easy to rename a column using SQL Server:

sp_rename 'table.old_column_name', 'new_column_name'

very simple, isn't it?