Blog posts

  • Can't log in to Windows after changing domain or workgroup?

    October 16, 2009 | Tags: Windows, Troubleshooting
    If you're having problem with logging into your Windows XP/2000/Vista/Whatever after you changed domain or workgroup. Here's the possible ways to solve it.

    Login using your local Administrator account. If you have forgotten the password try to reset the local Administrator password instead. You'll find a great tool for it here:

  • Calling methods in an ASP.NET page using jQuery

    October 14, 2009 | Tags: Javascript, ASP.NET, C#, jQuery, Snippet
    This is a very neat way to call a specific method in an ASP.NET page without going through the whole page event cycle. And you can use the Ajax enabled javascript library of your choise. I will be using jQuery in this example.

    First of all make sure you have this section in your web.config. Otherwise you'll be getting the whole content of the page and the method you are thinking you're calling won't be reached at all.

    So, step number one, make sure this is in your web.config:

    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    Step number two, open your default.aspx.cs-file and add our new method GetName. Notice the [WebMethod] attribute before the method. This is what exposes the method to outside calls. Also notice that the method is both static and public.

    Parameters is passed from jQuery as post data. But notice that you don't need Request.Form at all and that it's translated to normal function parameters.

    public partial class _Default : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {

    public static string GetName(string name) {
    return "Your name is " +name ;

    Okay, we're nearly there. Now we just need to call the method. On the default.aspx page, include the jQuery script in the head. I'll show another neat thing here. How you can use Google's CDN (Content Delivery Network) to fetch the jQuery library, thus speeding up the loading of your page. Instead of your local jQuery javascript file, point toward this:

    Here's the complete code for your aspx page (don't delete your first row (<%@ Page ..) though!):

    <html xmlns="" >
    <head runat="server">
    <script src=""></script>
    <script type="text/javascript">

    function getDataFromWebMethod() {
    type: "POST",
    url: "Default.aspx/GetName",
    data: "{ name: \"John Doe\" }",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {

    <form id="form1" runat="server">
    <a href="javascript:getDataFromWebMethod();">Get Data</a>

    [Code updated 2011-03-22. The return value is accessed by msg.d and not just msg]

  • Culture specific parsing of decimal numbers

    October 09, 2009 | Tags: C#, Snippet
    Ever wanted to convert a decimal value that you know the format of without depending on what culture information the current app is running under? Well, here's how:
    System.Globalization.NumberFormatInfo format = new System.Globalization.NumberFormatInfo();
    format.NumberDecimalSeparator = "."; // this could be "," etc
    format.NumberGroupSeparator = ",";
    double d = Convert.ToDouble("9.95", format);
    string s = d.ToString(f); // back to "9.95"

  • Problem with Korean _sans font in Flash

    October 07, 2009 | Tags: Actionscript, Troubleshooting, Flash
    It appears as the none embeded fonts (like _sans and _serif) in Flash can appear very moody. In the current Flash project I ran into some problem with a Korean version where at some points characters in textfields using _sans where displayed as missing (a box appeared instead of the character).

    What seem to have been the problem was a scaling tween on the movieclip that included the textfields. Removing the scaling made the characters display correctly all the time.

  • Quick way to copy layer masks in Photoshop

    September 24, 2009 | Tags: Photoshop, Snippet
    Hold down CTRL + ALT and drag and drop the layer mask you want to copy onto the layer where you want it.