C# - How to Reverse a Unicode String


Perhaps due to the lack of a built-in String.Reverse method in the .NET Framework, it's very common for implementations of such a method to be posted.
Unfortunately, most of these implementations do not handle characters outside Unicode's Basic Multilingual Plane correctly. These supplementary characters have code points between U+10000 and U+10FFFF and so cannot be represented with one 16-bit char. In UTF-16 (which is how .NET strings are encoded), these Unicode characters are represented as two C# chars, a high surrogatefollowed by a low surrogate. When the string is reversed, the order of these two chars has to be preserved.
Here's our method that reverses a string while handling surrogate code units correctly:

C# - How to Reverse a String

Unfortunately, C#'s string class is missing a Reverse() function, so here are three ways to reverse strings:

1. Manual Reversal

The most obvious way is to reverse a string by manually walking through it character for character and building a new string:

string input = "hello world";
string output = "";
for (int i = input.Length - 1; i >= 0; i--)
{
    output += input[i];
}
Note that if you take this approach in a serious program, you should use StringBuilder instead of string, since in the above code, a new temporary string is created each time you add a single character to the output string.

C# - Booleans Without Short-Circuiting

C# implements the boolean AND and OR operations like C/C++ with the operators && and ||.
The 'single character' versions of these (& and |) are used in both languages for bitwise AND and OR operations.
But in C# the single character versions can be used for boolean logic too, but with a twist.
The standard boolean operators (&& and ||) try to make your code as efficient as possible, by employing short-circuiting, to skip evaluation where possible.
If we have a boolean AND expression with two arguments, we know that the expression as a whole is false if one (or both) of the arguments is false. Thus when the first argument is false, the end result is known, and the second argument is never evaluated.
With OR it's the other way around: if one argument is true, the whole expression is true. Thus if the first argument evaluates to true, the second argument isn't evaluated.
Consider this sample class:

C# - Efficiently Looping Over An Array

This tip can improve the speed of programs that spend a lot of time looping over arrays.

Propably you know from experience, that when you try to access an invalid array element (say, index 11 in an array of size 10) you will get an IndexOutOfRangeException. To be able to generate this exception and prohibit the dangerous access of memory beyond your array storage, the runtime performs an array bounds check everytime you access an array, which checks that the index you supply is lower then the array size.
For example, take a look at this code:

How to Optimize a Wireless LAN Card

A wireless LAN card or wireless adapter is a device that allows a computer to connect to wireless Internet signals. Wireless Internet speeds can vary based on the strength of the wireless signal that the wireless adapter detects. You can take steps to optimize your wireless adapter to improve signal strength and to obtain a faster Internet connection. There are a few different ways to improve a wireless adapter’s connectivity.

10 Tips For Improving Your Wireless Network


Having trouble getting a good signal with your wireless network? Before you dropkick the kitty, consider these ten tips on how to improve your signal range and strength.


1. Position your wireless router (or wireless access point) in a central location.
When possible, place your wireless router in a central location in your home. If your wireless router is against an outside wall of your home, the signal will be weak on the other side of your home. Don't worry if you can't move your wireless router, because there are many other ways to improve your connection.



How to set Apache not to log requests for images or javascript


Having around 100 visitors per day could make your apache logs very large and this would not be very pleasant for any web server admin. One thing you could do is to configure apache not to log requests for Images, java scripts or any other extension.

How to prevent visitors from viewing .htaccess and .htpasswd files

Hide .htaccess file by disallowing access to .htaccess files to browsers
Every .htaccess file from any web server out there will have sensitive data inside it. If .htaccess files are not protected by default, they can be accessed by anyone (just type in your borwser: http://www.site.com/.htaccess and, if this restriction is in place, you'll get a 403 Forbidden error).

How to Bypass BIOS Passwords


BIOS passwords can add an extra layer of security for desktop and laptop computers. They are used to either prevent a user from changing the BIOS settings or to prevent the PC from booting without a password. Unfortunately, BIOS passwords can also be a liability if a user forgets their password, or changes the password to intentionally lock out the corporate IT department. Sending the unit back to the manufacturer to have the BIOS reset can be expensive and is usually not covered in the warranty. Never fear, all is not lost. There are a few known backdoors and other tricks of the trade that can be used to bypass or reset the BIOS

Before attempting to bypass the BIOS password on a computer, please take a minute to contact the hardware manufacturer support staff directly and ask for their recommended methods of bypassing the BIOS security. In the event the manufacturer cannot (or will not) help you, there are a number of methods that can be used to bypass or reset the BIOS password yourself. They include:

Reveal *****(Asterisk) Password of a Web Page Using Javascript


Want to Reveal the Passwords Hidden Behind Asterisk (****) ?
Here's a quick and simple way
  •  Open the Login Page of any website. (eg. http://www.facebook.com)


  • Type your 'Email' and 'Password'.
  • Use the built in browser tool for displaying the the web page HTML source.
  • Locate the id of the password text box ("pass" in this case).
  • Copy and paste the JavaScript code given below into your browser's address bar and press 'Enter'.
javascript: alert(document.getElementById('pass').value);
  • As soon as you press 'Enter', A window pops up showing Password typed by you..!