FCKeditor 2.x: How to get an instance of the editor using javascript
This is how you get an instance of the editor when you are within the page that loads the editor: Read More »
This is how you get an instance of the editor when you are within the page that loads the editor: Read More »
In order to convert from a string to an enumeration in .NET you can use the method Enum.Parse as follows:
public enum SortExpressions
{
FirstNameAsc,
FirstNameDesc,
LastNameAsc,
LastNameDesc
}
var value = "lastnameasc";
var sortExpression = (SortExpressions) Enum.Parse(typeof(SortExpressions), value, true);
Since this operation is often needed we should make a ConvertToEnum method so we can reuse it. But instead of returning it as the typical object type, we should rather use generics to return it as the actual type: Read More »
Imagine you have a user interface with a list of products. On the side of each product you have a delete checkbox and then a delete button below the list. Even though a user can delete multiple products at once, you only want to query the database once. One way to achieve this is by sending a comma separated string with product id’s to a stored procedure. The stored procedure will then loop through the string, grab each id and delete the corresponding row in the product table. Read More »
In my post How to extend classes using extension methods, I write about how to extend classes with your own methods. This time we will extend the IDataReader interface with some new methods to save some typing. Since we extend the interface, our methods will be available in all the classes implementing the IDataReader interface, such as the SqlDataReader. Read More »
In .NET 3.5 there is a new functionality called extension methods. Extension methods let you extend any classes in the .NET framework, 3rd party frameworks or your own frameworks with your own methods. Read More »
In C#, when you want to make sure an object is disposed, then you might place you’re code within a try finally block as follows: Read More »
In the .NET framework you have the System.Diagnostics.EventLog class which provides static methods for working with the Windows event log. Read More »
In C# you have the break statement which is most often seen in relation to terminating a switch statement. However it can also be used to terminate any loop statement as follows:
for (int i = 0; i < 10; i++)
{
if (i == 5) break;
}
If you have nested loop- or switch statements, then the break statement will only terminate the closest one.
In need of some new colors for my blog, I started searching for a color schema tool and then I came across Kuler from Adobe Labs. As of this writing there are more than 46 000 color schemas available, organized by tags, names, popularity and rating. All of them are created by the Kuler users.