Here’s what the icons in Intellisense from Microsoft Visual Studio .NET represent: Assembly Delegate Event Interface Namespace Structure Public class Protected class Private class Public constant Protected constant Private constant Public enumeration Protected enumeration Private enumeration Constant inside enumeration Public method Protected method Private method Public property Protected property Private property Public variable Protected variable […]
Search and replace table field contents
The query below will replace all occurences of “Bob Loblaw Law Blog” found in the field “BlogName” field of the Blogs table. All instances of the string are being replaced, and the search is case sensitive. The function is also multi-byte safe.
Google Chrome Beta User Agent String
The first beta version of the Google Chrome browser has an user agent string of its own, and although it will change with the next version, it will most likely follow the same format thus making it safe to implement into your current code: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) […]
How do I set the type of an enumeration?
Usually you don’t specify a type for an enumeration and the default will be considered, which is int.In the following example we change the type to unsigned int (uint):
How To Prevent Hotlinking Using .htaccess
A very easy way to prevent your gif, jpeg, png files (and any other file formats you choose) from being hotlinked in other websites is to use a few mod_rewrite rules in your .htaccess file.
When you have to pass an array to a method, you can directly pass the values without creating the array
If you have to pass an array to the method myMethod you would usually do something similar to this: int[] myArray = new int [3] {23, 48, 96, 114};myClass.myMethod(myArray); But why create an array when you can pass the integers directly? The compiler takes care to pack the integers into an array. myClass.myMethod(23, 48, 96, 114);
How to check if a registry key / subkey already exists
The following example shows you how to check if a key in the Windows registry exists, in this case the key named Test which is situated in HKEY_CURRENT_USER\Software\Geekpedia. Registry.CurrentUser tells the program to use HKEY_CURRENT_USER. We use double backslashes to escape the slash in the registry path, but we can aswell use:
Do I need the PDB (.pdb) file when I deploy my ASP.NET application?
Program Debug Database (PDB) is not normally required for your ASP.NET web application to run, however they are required for debugging. PDB files are used to store debugging information and they are created when you compile the application. In ASP.NET, as well as other .NET applications, PDB files serve a crucial role in the debugging process. […]
Array creation must have array size or array initializer
Array creation must have array size or array initializer error is caused by a line similar to the following: And the problem with this line is that you create a new array but you don’t define a size. When you create an array you have to either define a size for the array, or declare […]
How do I get the values when submitting a form (either using GET or POST)?
This is a popular question among ASP.NET beginners, because this is done fairly different with .NET. While in PHP you would use $HTTP_POST_VARS[‘field1’] and $HTTP_GET_VARS[‘field1’] to get the value passed from a form (either using POST or GET method), in ASP.NET there is a big difference.First, if you pass the value using the GET method […]