If you are interested in changing the Visual Studio’s 2012 menu from this
How to disable all caps.
- Open up regedit. (Start -> Run -> Type regedit)
- Navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General.
- Add a new DWORD value with the name SuppressUppercaseConversion.
- Set its hexadecimal value to 1.
That is all, simply restart Visual Studio and the menu should not be in all caps now.
The best way of monitoring the data in the clipboard through your application is by adding your application’s window to the chain of clipboard viewers so it can receive the
WM_DRAWCLIPBOARD message when the clipboard data is modified.
In order to do that we need to make use of the Windows
ChangeClipboardChain APIs in order to monitor when the
WM_DRAWCLIPBOARD message triggers.
First we will need to pinvoke
WM_DRAWCLIPBOARD and also set the variables that will hold the value for the next window in the chain that is required when we will want to stop our window from monitoring the clipboard. Place the following in your class.
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern bool ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);
private const int WM_DRAWCLIPBOARD = 0x0308; // WM_DRAWCLIPBOARD message
private IntPtr _clipboardViewerNext; // Our variable that will hold the value to identify the next window in the clipboard viewer chain
UDP hole punching is a method that is used to establish connectivity between two hosts that are behind a NAT (router) without the need of having the clients port forward specific ports.
When the client sends a UDP packet to the server the router creates a temporary rule mapping, the server then uses the incoming IP address and port it receives the message from to send a message to the client, which refreshes (in most cases) the lifetime of the temporary mapping on the client’s router and allows the server to communicate constantly with the client without the need for the user to do anything from their side.
This method is also used to send messages between two users that are behind different NAT’s. The difference in the implementation is that the clients first contact with the server, which should have a port open in order to be able to receive the information from the clients. After the server receives the information from the clients it sends each client the IP and port of the other client, allowing both of them to communicate with each other.
I’ve created a small example on how the implementation of a UDP hole punching looks in C#, this should give you the general idea of how it works and let you expand it as you like. The example simply receives a message from the client then sends a response. If you want the server to handle more than one message then you will need to add some loops.
Mozilla released Firefox 20 a few days ago that came with various new features such as:
- a new per-window Private Browsing feature
- a new download manager
- the ability to close unresponsive plugins without the need to restart the browser
Sadly my personal opinion about the new download manager feature isn’t very good. The new manager seems to be very user unfriendly and from what I can see there isn’t an option in the settings to clear a download file from the history automatically after the file has been downloaded. Luckily there is an easy solution for this for those that would like to revered back to the old download manager design.
- Type about:config in your address bar
- Search for browser.download.useToolkitUI
- Set its value to true
Now everytime you download something the old version of the download manager will start instead of the new one.
If you also want to remove the new download button that was added in this new version simply right click on the bar, click Customize… and drag and drop the button you don’t want into the customize toolbar list that will appear.
It is considered a very bad idea to store user credentials in plain text, especially passwords. For that very reason it is always a good idea to hash passwords before you store them, ideally with a unique salt that you can store in another location. That way if for whatever reason your database is compromised your users passwords will not be in plain text and it will require a bit of work in order to find out what each password is, especially if the salt for each password is stored somewhere else.
The following method is a multi algorithm method, that means that with this single method you can use more than one algorithm to hash your data. The snippet below shows an example how to hash your data with a single method using seven different algorithms.
Our main method that will do all the work for us:
private string StringToHash(string data, string salt, HashAlgorithm algorithm)
byte saltedBytes = Encoding.UTF8.GetBytes(data + salt); // Combine the data with the salt
byte hashedBytes = algorithm.ComputeHash(saltedBytes); // Compute the hash value of our input