C# – Implementing Finalize and Dispose to clean up resources

Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. To provide explicit control, implement the Dispose method provided by the IDisposable interface. The consumer of … Continue reading “C# – Implementing Finalize and Dispose to clean up resources”

The ideal way to modify the displayed content of all WordPress posts

What will be exemplified here is a way to add content to the footer of posts for viewing without changing the current content of the posts in the database. For this we will use the_content Filter hook. This hook allows you to alter the content for all posts and pages being displayed in the browser. … Continue reading “The ideal way to modify the displayed content of all WordPress posts”

A free ebook for JavaScript programming.

Kindle and paperback versions A great free ebook for Javascript programming (490 pages, pdf and epub formats) Free download (PDF) Eloquent JavaScript – A Modern Introduction to Programming (EPUB) This book as an EPUB file Copyright © 2014 by Marijn Haverbeke About the author Marijn Haverbeke is a programming language enthusiast and polyglot. He’s worked … Continue reading “A free ebook for JavaScript programming.”

Free pdf book with advices and tips for writing better code (c# and .net)

A good book with advices and tips for writing better code. Free download FoundationsOfProgramming.pdf Copyright © Karl Seguin About the Author Karl Seguin is a developer at Epocal Corporation, a former Microsoft MVP, a member of the influential CodeBetter.com community and an editor for DotNetSlackers.

C# – Throwing Exceptions best practices

Many people questioned themselves about which of the two forms is the best to (re) throw an exception? Is it better to do this : or this: The way to preserve the stack trace is through the use of the throw; This is valid as well throw ex; is basically like throwing an exception from … Continue reading “C# – Throwing Exceptions best practices”

C # – Understanding ‘in’ and ‘out’ (Generic Modifier)

in (Generic Modifier) For generic type parameters, the in keyword specifies that the type parameter is contravariant. You can use the in keyword in generic interfaces and delegates. Contravariance enables you to use a less derived type than that specified by the generic parameter. An interface that has a contravariant type parameter allows its methods … Continue reading “C # – Understanding ‘in’ and ‘out’ (Generic Modifier)”

How to create a WordPress plugin

(At the time of this writing, last stable WordPress version was 4.4.2) In the plugins folder (normaly at …/wp-content/plugins) create a new folder with your plugin name. The name should be unique because all WordPress plugins exist in the same folder. If your plugin file name is too generic, you run the risk of another … Continue reading “How to create a WordPress plugin”

C# – how to assign a default value to generic type var

In generic classes and methods, one issue that arises is how to assign a default value to a parameterized type T when you do not know the following in advance: Whether T will be a reference type or a value type. If T is a value type, whether it will be a numeric value or … Continue reading “C# – how to assign a default value to generic type var”