Dealing with a MySQL warning from my hosting provider

I got a warning email from my hosting company today MySQL Quota DB: has used 136.87 MB out of 50 MB limit After some research I discovered that 2 database tables used by Apocalypse Meow are using approx. 120MB. I resolved the issue: Delete the data: open Apocalypse Meow settings page and click Purge ALL data Reclaim the disk space:… Read more →

LINQ: Group a list of strings into chunks

LINQ: Group a list of strings into chunks, dividing the chunks by a whole-line marker (in the example “<Custom>”) public static partial class Queries { public static IEnumerable<string[]> Execute( this IQueryHandler<DataChunker, IEnumerable<string[]>> handler, IEnumerable<string> data) { return handler.Execute(new DataChunker(data)); } public class DataChunker : IQuery<IEnumerable<string[]>> { public DataChunker(IEnumerable<string> data) { this.Data = data; } public IEnumerable<string> Data { get; set;… Read more →

Markdown and Prettify V2

Install the smart syntax plugin Go to Smart Syntax settings tab and ensure that Custom Skin is ticked Remove the following from smart-syntax/includes/functions.php: remove all 3 lines ?> <script>prettyPrint()</script> <?php Open file wp-content/plugins/smart-syntax/assets/css/smart_syntax.css and replace the contents with this: .prettyprint .com { color: #008000; } .prettyprint .str, .tag { color: #A31515; } .prettyprint .kwd, .atv { color: #0000FF; } .prettyprint… Read more →

Give background threads time to complete in IIS

Thanks to this post public sealed class OutOfProcessMediatorDecorator<TCommand> : IMediatingHandler<TCommand>, IRegisteredObject where TCommand : IMediator { private readonly IMediatingHandler<TCommand> decorated; private readonly Container container; public OutOfProcessMediatorDecorator( IMediatingHandler<TCommand> decorated, Container container) { this.decorated = decorated; this.container = container; } public void Execute(TCommand command) { HostingEnvironment.RegisterObject(this); var task = Task.Factory.StartNew(() => { using(container.BeginLifetimeScope()) { try { this.decorated.Execute(command); } finally { HostingEnvironment.UnregisterObject(this); }… Read more →

System.Windows.Controls.WebBrowser

interaction from javascript in the Document to external C# code [ComVisible(true)] public class ScriptProxy { // This method can be called from JavaScript. public void AMethod(string message) { MessageBox.Show(message); } } this.webBrowser1.ObjectForScripting = new ScriptProxy(); <input type=”button” value=”Go Again!” onclick=”window.external.AMethod(‘Hello’);” /> subscriber to browser events thanks to this answer [ComVisible(true)] [ClassInterface(ClassInterfaceType.AutoDispatch)] public class EventListener { [DispId(0)] public void NameDoesNotMatter(object data)… Read more →

NDepend, a second look

After my previous post regarding NDepend I have decided to give it another go, this time on a new project. I am using Visual Studio 2015 for the first time so need to install NDepend for VS2015; this is now very easy after setting things up last time. Navigate to the NDepend folder, run NDepend.VisualStudioExtension.Installer.exe and click install for VS… Read more →

NDepend, a first look

After reading @DaedTech’s very persuasive arguments for static code analysis I have decided to give NDepend a go. Download and install is slightly fiddly, you get a zip file with a number of files. Once you have found the instructions on the web site it takes just a couple of minutes to get set up. I analysed my current project… Read more →

Generate POCO’s from Sql Server

DECLARE tableCursor CURSOR LOCAL FOR SELECT name, ‘Foundation’, name + ‘Dto’ FROM sys.tables WHERE 1 = 1 OPEN tableCursor DECLARE @tableName NVARCHAR(MAX), @schemaName NVARCHAR(MAX), @className NVARCHAR(MAX) FETCH NEXT FROM tableCursor INTO @tableName, @schemaName, @className WHILE @@FETCH_STATUS = 0 BEGIN DECLARE tableColumns CURSOR LOCAL FOR SELECT cols.name, cols.system_type_id, cols.is_nullable FROM sys.columns cols JOIN sys.tables tbl ON cols.object_id = tbl.object_id WHERE tbl.name… Read more →