Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Discussions

AndyC AndyC
  • .net framework math error

    Rossj wrote:

    I tried it with gcc on my mac and got 0.060000 - those weird PPC guys eh?


    The error is most likely masked by the number of significant digits displayed. Try comparing the result with 0.060000 and you'll most likely find the comparison fails.

    In .NET, the Decimal data type is recommended for financial calculations as it has significantly greater precision.

  • Format time.. 2003 server for desktop?

    Minh, log in as Administrator and then change the security permissions such that your ordinary user account has read/write permission.

  • Performance Cost

    I'd expect (though haven't looked) that the compiler would optimise the overhead away and just look directly at the value of _num.

  • Longhorn pushing larger monitors?

    The sidebar is just about workable at 1024*768 though you'd probably want to have it hidden at that res (yes you can hide it in current builds!) as screen real estate is so limited.

    On larger screens it's actually pretty useful. The portrait nature of most documents (compared with landscape shaped displays) means you often waste a portion of the screen anyway, so it might as wel be displaying some useful info (Office 2003's help already demonstrates this somewhat).

    Longhorn's support for high density displays mean higher resolutions on smaller displays are going to become common.

  • Why can structs not be null in C#?

    Smiley

    I think this is one of the areas in which C# can really sting C++ programmers.

    In C++ struct/class are (almost) interchangable, with most people choosing struct to mean something that isn't going to have member functions and class for everything else.

    In C# the difference is much more pronounced.

  • Why can structs not be null in C#?

    ScanIAm wrote:
    Poorly or ignorantly...my guess is I've chosen ignorantly   It seems a little annoying, however, that the explanation of a stack pointer, academic or not, depends on the hardware. 


    Bad wording on my part. All modern CPUs have addressing modes that speed up this type of indexed operation because it's an extremely common operation. Think about how the CPU identifies individual fields in a class/struct - if you guess an offset to a pointer, you'd be right.

    Dereferencing pointers is always going to be slower, because it requires two lookups in memory (one to lookup the value of the pointer, one to then lookup the actual object) rather than just one.

    Classes could have been used for what you're suggesting if they'd added a [ClassLayout] attribute. The reason this isn't available is actually Garbage Collection. Why? The main reason for wanting to force the layout is when doing a PInvoke. You really don't want the GC to "helpfully" relocate your object mid way through a call to a native function. It's much better to locate the data on the stack as it's position is guaranteed throughout the lifetime of the current scope, hence structs.

    In C# you nearly always want classes except when doing PInvoke or when dealing with small objects when you don't want the overhead of creating objects on the heap.

  • Why can structs not be null in C#?

    Classes live on the heap. The only way to "find" a class is with a pointer. And so classes always live at the end of a pointer. Even in languages which hide this (like C#) this is true.

    Structs live on the stack. Now, you could "find"  structs using pointers, but that would be slow and cumbersome. It's much faster to use an offset from the stack pointer; the distinction may seem academic, unless you're familiar with x86 addressing modes, but it's important. Using pointers would cause additional problems, what would it mean to re-assign the value of a struct? What would it mean to assign it the value NULL?

    Nullable structs can be achieved by sticking a hidden "Is this struct Null?" field, so why wouldn't the CLR designers do that? One of the big advantages of structs is the ability to exactly determine the layout, using the [StructLayout] attribute - particularly useful for PInvoke scenarios. Now if you start adding hidden fields into explicitly laid out structures the potential for inadvertantly breaking stuff is enormous.

    If you find yourself repeatedly asking "Why can't this struct be NULL?", you need to sit down and ask yourself "Why do I think this is a struct and not a class?" Chances are you've chosen poorly.

  • Yet another post about Full screen

    Jamie, that only happens if you try and force full screen onto a user. If you give them the choice, then it goes full screen the way it is supposed to. Give users a choice.

    BTW, full screen has never been "full" so most of the points in your original PPT are plain wrong. Don't believe me? Try F11 on a mulitple monitor setup and you find it only fills one screen, so assuming you can replace the Start menu, desktop etc is flawed anyway - you're unnesessarily restricting the amount of space a user can devote to your webpage, not increasing it.

    Kiosk mode is for kiosks.

  • Yet another post about Full screen

    bsilby wrote:


    Nevertheless, a small part of me does believe that the website author should have his work displayed as he intends it.


    Think of it as being like an artist, commissioned to do a painting on canvas given to him by me. He has no say over it's dimensions, I do. Now within that canvas he should be allowed to do whatever he chooses to express his idea. However, I don't expect him to start painting all the rest of my furniture just because it fits better with his vision that way.

    In the case of web design, that canvas is the client area of the Window. The browser chrome should be sacred, it's there for the browser to communicate with me, not the web page I'm viewing.

    And yes, W3bbo, I'm with you 100% on stopping webpages accessing the status bar.



  • Yet another post about Full screen

    jamie wrote:

    to me the whole issue is a matter of control - ms taking away the ability to control what the user can see - we had the ability before now its gone.


    Yes, it's about control and choice. This is my computer, I control what I see - not you. If I want IE to run full screen without a status bar, I can choose to do so. If you want me to run IE full screen without a status bar, you can ask me to and then I can make that choice. I control my environment. You do not.

    Give it up. Web developers should never have been allowed such a dangerous level of control and they are not going to get it back.

    If you need that much control then write an application and give me a choice as to whether or not I download and run it.