http://blogs.clariusconsulting.net
stats
460 posts and blogging
Latest Posts
Detecting HTML textboxes’ (input[type=text]) changes immediately using JQuery
Today, I had faced another problem very common for Web developers, how you can detect any change that happens on one input type=text (from now on “textbox” or “textboxes”) that you have on your DOM immediately. To make this clear, we’re trying to reproduce search engines behaviors: you write anything, in any way, as soon [...]
How to: Expand Div/Tables Height to 100% using JQuery
As a web developer, one of the problems that you might face is that divs and tables cannot expand themself to go full height just using CSS. After researching about it for a while, I detected that the only way to fix it is using JavaScript. Of course you can take advantage of JQuery to [...]
How to: Debug a WinRT Component (C++) consumed by a C# / JS project (Metro apps)
By default in VS2011, you won’t be able to debug WinRT Components that you consume from C#/JS projects. This is because unmanaged code debugging is disable by default. To workaround this, you need to go to Solution Explorer, right-click your Startup project (C# or JS), and select Properties menu. Under the Debug tab, check the [...]
WinRT: "Illegal Characters in the path" exception when deploying Metro apps on Windows 8
When you’re coding your Metro app application using Dev11, you can see this exception when you have invalid characters in the path. But it’s not only caused by this. This can be also caused right after you move your solution folder (and the projects) to a different folder, you open it again, you try to [...]
How to: programmatically load an Image into an ImageBrush from an Uri on WinRT (Metro apps)
var bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(“ms-appx:/Assets/Logo.png”)); Windows.UI.Xaml.Media.ImageBrush image = new Windows.UI.Xaml.Media.ImageBrush() { ImageSource = bitmapImage };
How to map a shared SkyDrive folder as a network drive in Windows
Open the folder in the skydrive site using the browser (it would be under Shared menu on the left). The url will look something like: https://skydrive.live.com/?cid=529BD9445B66F60D&id=529BD9445B66F60D%21189#cid=529BD9445B66F60D&id=529BD9445B66F60D%21189. Now the “cid” query parameter in the URL. Right-click on Network (in windows explorer), then “Map Network Drive” Specify Folder as: https://d.docs.live.net/[cid]/[folder_name]. For the sample URL above, it would [...]
A better way to encourage contributions to OSS
Currently in the .NET world, most OSS projects are available via a NuGet package. Users have a very easy path towards *using* the project right away. But let’s say they encounter some isssue (maybe a bug, maybe a potential improvement) with the library. At this point, going from user to contributor (of a fix, or [...]
You don’t need an IoC container or ServiceLocator for everything
Say you have a class that needs to collaborate with another, say a repository: public class OrderProcessor { public void ProcessPayment(Guid orderId, Payment payment) { using (var repo = new OrmRepository()) { var order = repo.Find<Order>(orderId); order.Pay(payment); repo.Save(order); } } } Now that clearly is very hard to test ‘cause it’s directly instantiating the repository. [...]
Event Centric: storing and consuming events
[Disclaimer: I don’t think this disclaimer is needed, but just to be on the safe side. The opinions expressed herein are my own personal opinions and do not represent in any way my company's view, that of any customer current or past, or any current, past or future project related to these concepts that I [...]
A better way to implement the Singleton (anti?) pattern for easier testing using AmbientSingleton
In .NET singletons are typically implemented with a static variable that you control access to: public class SystemClock : IClock { private SystemClock() { } static SystemClock() { Instance = new SystemClock(); } public static IClock Instance { get; private set; } } Fairly easy. Problem is, of course that there’s no way you can [...]