Thursday, January 05, 2006

I always assumed that when the documentation for the JavaScript window.open said that the "height" argument "Specifies the height of the window, in pixels" that it meant the height of entire parent window (the one with the "X" in the upper-right corner) not the client-size of the browser control window!  The same is true of the "width" argument. (at least we're consistent!) 

So, if you're worried about the positioning and sizing of a popup window be sure to account for the size of your status bar, toolbar, and outer border of your window.  They all 3 affect how window.open is (or should be) handled.

Friday, January 06, 2006 1:18:21 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, January 04, 2006

I've been wondering for a while if the System.Drawing.Rectangle structure could be used for PInvoke in place of the Win32 RECT structure, so I thought I would write a little application to verify my guess (overkill, I know... but fun none the less.)  The output: 1,2,3,4 and 1,2,2,2.  If they were compatible they would have been the same, therefore you cannot use the Rectangle structure interchangeably with the RECT structure for PInvoke.

using System;

using System.Drawing;

using System.Runtime.InteropServices;

 

namespace RECTvsRectangle

{

    [StructLayout(LayoutKind.Sequential)]

    public struct RECT

    {

        public int Left;

        public int Top;

        public int Right;

        public int Bottom;

    }

 

    static class Program

    {

 

        static void Main()

        {

            int intSize = Marshal.SizeOf(typeof(int));

            int rectangleSize = Marshal.SizeOf(typeof(Rectangle));

            int rectSize = Marshal.SizeOf(typeof(RECT));

 

            RECT r1;

            r1.Left = 1;

            r1.Top = 2;

            r1.Right = 3; //width = 2

            r1.Bottom = 4; //height = 2

 

            Rectangle r2 = Rectangle.Empty;

            r2.X = 1;

            r2.Y = 2;

            r2.Width = 2;

            r2.Height = 2;

 

            IntPtr p1 = Marshal.AllocCoTaskMem(rectSize);

            Marshal.StructureToPtr(r1, p1, true);

 

            IntPtr p2 = Marshal.AllocCoTaskMem(rectangleSize);

            Marshal.StructureToPtr(r2, p2, true);

 

            for (int i = 0; i < rectSize; i += intSize)

            {

                Console.WriteLine("Value: " + Marshal.ReadInt32(p1, i).ToString());

            }

 

            Console.WriteLine("---");

 

            for (int i = 0; i < rectangleSize; i += intSize)

            {

                Console.WriteLine("Value: " + Marshal.ReadInt32(p2, i).ToString());

            }

 

            Marshal.FreeCoTaskMem(p1);

            Marshal.FreeCoTaskMem(p2);

        }

    }

}

Thursday, January 05, 2006 2:38:43 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 

Interested in all this AJAX business?  You should really check out JSON (JavaScript Object Notation).  Here's an article discussing the pros and cons of 3 different AJAX return formats: The AJAX response: XML, HTML, or JSON?

Wednesday, January 04, 2006 7:28:22 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, January 03, 2006

David Mohundro (aka "MO") set up his blog over the weekend: http://www.mohundro.com/blog.  Everyone say hello to David.

Tuesday, January 03, 2006 7:34:59 PM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, December 28, 2005

Under "Configuration" > "Appearance Settings" in dasBlog, there is a neat little option called "Use Post Title for Permalink."  This sounds like a good idea, right?  I thought so, so I turned it on.  Cool... it gets rid of that GUID-looking mess in your URLs when people (you) link to your site.  Life is good.  I updated my links to reflect their new descriptive URLs, but then I thought "I wonder how it handles non-alpha/numeric characters", so tried clicking on an example titled "Control-click + Taskbar = Awesome!".  Guess what!  "Page not found".  Bummer.  I just got done changing all my links back :-)

Thursday, December 29, 2005 7:38:59 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [0]  |