Author Archives: CooLMinE

Clear all Windows event logs

Windows logs a lot of information in the event logs to make it easier for users to troubleshoot potential problems with their system.

Each event log category has a default limit of 1028 kilobytes. Because of that it is possible for a category to store a few thousand entries dating back a few years. In my case I had entries that were older than 5 years. Obviously this might make it a bit harder to go through the logs, especially if you want to view the logs that were created after you made some particular change to the system which you want to verify that it did not cause any issues.

Sadly, there isn’t a default option to clear all the event logs at the same time and clearing up one category at a time is very time consuming due to the number of categories that are available. Luckily we can create a .bat file to do the work for us.

Open up your favourite text editor, insert the snippet below and save it with the extension .bat. You can give it any name you want. Then simply run the file as administrator and it will clear up all event log entries for you automatically.

ListBox selected item custom background and text color

This snippet will allow you to set a custom color for your ListBox’s selected item background as well as the selected items text color.

First make sure that your ListBox’s DrawMode is set to OwnerDrawFixed. This can either by done in the controls properties window or by calling listBox1.DrawMode = DrawMode.OwnerDrawFixed;

Then we need to handle the ListBox’s DrawItem event which is where we will be doing the changes to the selected items.

How to disable plugin-container

Plugin-container.exe is a Firefox process that is used to load plugins separately so if a plugin crashes for whatever reason, Firefox won’t be affected by the crash and will stay responsive.

Since there are a lot of people experiencing problems with the plugin-container process I wanted to provide you with two easy methods for disabling it.

In older versions of Firefox it was possible to disable plugin-container.exe by following the steps below.

First method

  1. Enter about:config in your address bar
  2. Search for dom.ipc.plugins.enabled
  3. Set their values to false

Sadly the above method doesn’t seem to work anymore with the newer versions of Firefox. Luckily there is a different workaround which can achieve the same exact result by setting a system or a user environment variable. Follow the steps below if the first method did not work for you.

Second method

  1. Right click on your computer icon on the desktop and click properties
  2. Go to Advance system settings
  3. Click the button called "Environment Variables"
  4. Click the “New” button under User variables or System variables depending if you want the change to affect all the users on the system or just the one you are currently logged as
  5. Set the variable name to MOZ_DISABLE_OOP_PLUGINS and its value to 1

And that is all you have to do. Now simply restart Firefox and you will notice that the plugin-container.exe process will not be used any more.

Visual Studio 2012 Update 2

Microsoft has released Visual Studio 2012 Update 2 (Visual Studio 2012.2). This update contains numerous features as well as bug fixes and also includes all the changes of the first update which means you can safely skip update 1 if you haven’t already installed it.

For detailed information on what update 2 has to offer visit http://support.microsoft.com/kb/2797912

Visual Studio 2012 Update 3 is now available. Read Visual Studio 2012 Update 3 for more information.

How to create and connect to an SQLite database in C#

The aim of this tutorial is to teach you how to create a new SQLite database from scratch, create a new table in it, insert and read values from it. This is merely an entry level example to give you an idea on how to start.

First you will need System.Data.SQLite library from system.data.sqlite.org. Head over to their download section and download the libraries that best suit your need depending on the .NET Framework you want to target and the Windows bit version.

Extract the file and add System.Data.SQLite.dll as a reference in your project. Keep in mind that SQLite.Interop.dll also needs to be in your executables directory but doesn’t need to be added as a reference in your project. Moreover, if your application is targeting Any CPU it is likely that you will get an exception. So make sure to navigate to Project properties -> Build and set the Platform target to the bit version of the System.Data.SQLite.dll binary you have downloaded.

Visual Studio application build settings - Platform target

Finally, the snippet below should give you the general idea on the main functions you will need to learn first, mainly

  • Creating a file for your database
  • Creating a table in your database
  • Inserting information in the database
  • Retrieving information from the database