How to Update Outlook Signature Automatically

I created a fun little program a while ago. It updates my Outlook signature with the current temperature in Melbourne, Australia. Here is C# source code: The program fetches the temperature from Australia’s Bureau of Meteorology (BOM) website. I created a Visual Basic Script to run so that I don’t see a black console window […]

Converting .Net DateTime to JavaScript Date

JavaScript Date constructor accepts number of milliseconds since Unix epoch (1 January 1970 00:00:00 UTC). Here’s C# extension method that converts .Net DateTime object to JavaScript date: public static class DateTimeJavaScript { private static readonly long DatetimeMinTimeTicks = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Ticks; public static long ToJavaScriptMilliseconds(this DateTime dt) { return (long)((dt.ToUniversalTime().Ticks […]

How to enable detailed error information for IIS and ASP.NET

By default, IIS and ASP.NET hide detailed error information to prevent revealing sensitive information about your web application: Sometimes you need to see error details (think shared hosting). Add these entries to your web.config file to disable generic errors: <configuration> <system.web> <customErrors mode=”Off” /> </system.web> <system.webServer> <httpErrors errorMode=”Detailed” /> </system.webServer> </configuration> Resources How to Use […]

jQuery BBQ plugin and Internet Explorer 7

Remember the problem with jQuery BBQ plugin in Internet Explorer 7? It’s not really a problem, just a minor glitch but let’s fix it anyway. Steps to reproduce: Open BBQ demo in Internet Explorer Click Next button few times Open history menu Observe: No page titles, just URLs. Definitely it would be nice to see […]

Using jQuery BBQ plugin for photo gallery

Click here to view demo Let’s take previous demo and use jQuery BBQ plugin instead. Our goal is Ajax photo gallery that supports browser’s back button. We will display numbers instead of actual photos for now. $(function () { $(window).bind(‘hashchange’, function(e) { var i = parseInt(e.fragment, 10); if (!isNaN(i)) switchTo(i); }); $(window).trigger(‘hashchange’); }); function switchTo(i) […]

Using Asual jQuery Address plugin for photo gallery

Click here to view demo Let’s say you want to build photo gallery. Something like this: You want to open next and previous photos without page reload, using Ajax. One problem with this is that browser’s back button stops working. Fortunately, it’s easy to fix with jQuery Address plugin from Asual. I tried using this […]

How to use ClientScriptManager.RegisterForEventValidation method

Have you ever encountered this error: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation=”true”/> in configuration or <%@ Page EnableEventValidation=”true” %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid […]

How to view whitespaces in Emacs

Here’s how you can view whitespaces in Emacs: M-x whitespace-mode RET By default, Emacs uses bright colours to highlight whitespaces that are in wrong place (in Emacs’ opinion): To disable colouring add the following to your .emacs file: ; disable colours in whitespace-mode (setq whitespace-style ‘(space-mark tab-mark)) Now it’s much better: I assign showing white […]