The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140417-Windows-8.1-Update-says-it-failed-but-it-succeeded

    20140417-Windows-8.1-Update-says-it-failed-but-it-succeeded--Windows-Help-and-Support--cannot-find-any-info--how-surprising-it-never-does

    20140329-VMware-vSphere-Client-4.1-retry-with-compatibility-settings

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,250 other followers

Archive for the ‘C#’ Category

.net/C# – Serialize into an XML Fragment – not XML Document – Stack Overflow

Posted by Jeroen Pluimers on 2014/04/17

Thanks User Andrew Hare – Stack Overflow for answering this on Stack Overflow.

I’m pretty sure it works in all .NET and C# versions starting with 2.0.

Here is a hack-ish way to do it without having to load the entire output string into an XmlDocument: Read the rest of this entry »

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

c# – Is there a library that gets the media type and subtype out of a HttpWebResponse/WebResponse ContentType? – Stack Overflow

Posted by Jeroen Pluimers on 2014/04/16

Just asked this on SO: C# – Is there a library that gets the media type and subtype out of a HttpWebResponse/WebResponse ContentType?.

Anyone here or at G+ that has a hint?

The ContentType property of (Http)WebResponse maps to the HTTP/1.1 Content-Type which is a Media-Type that contains a type/subtype optionally followed by parameters which are attribute=value pairs.

I’m mainly interested in the type/subtype and the charset parameter.

The charset is mapped from HttpWebRequest.CharacterSet.

Is there a library that just retrieves the media type/subtype of the ContentType?

–jeroen

via: c# – Is there a library that gets the media type and subtype out of a HttpWebResponse/WebResponse ContentType? – Stack Overflow.

Posted in .NET, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development, Visual Studio 11, Visual Studio 2008, Visual Studio 2010, Visual Studio 2013, Visual Studio and tools | Leave a Comment »

Monitoring HTTP Output with Fiddler in .NET HTTP Clients and WCF Proxies – Rick Strahl’s Web Log

Posted by Jeroen Pluimers on 2014/04/15

Reminder to self: for HttpWebRequest make sure you have your proxy setup correctly.

Monitoring HTTP Output with Fiddler in .NET HTTP Clients and WCF Proxies – Rick Strahl’s Web Log.

–jeroen

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, ASP.NET, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Fiddler, Software Development, Visual Studio 11, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools, Web Development | Leave a Comment »

.NET UI Automation examples: The managed way to retrieve text under the cursor (mouse pointer) (via: The Old New Thing)

Posted by Jeroen Pluimers on 2014/04/10

Some interesting UI Automation examples: The managed way to retrieve text under the cursor (mouse pointer).

  • find the text under the mouse cursor
  • run a the calc command
  • showing automation properties under the mouse cursor

–jeroen

via: The managed way to retrieve text under the cursor (mouse pointer) – The Old New Thing – Site Home – MSDN Blogs.

Posted in .NET, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs

Posted by Jeroen Pluimers on 2014/04/09

Interesting read:

The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs.

In other words: any language that merges null behaviour in the underlying storage will have a problem somwehere.

So if you want to have true nullable types, your null flag should be stored outside the underlying storage.

The .NET framework 2 and up, most database management systems and many other environment support that.

But most languages don’t support it for pointer types. So there will be portions of address spaces either inaccessible, or only accessible when skipping the null pointer checks.

Note that the thread above contains some very interesting bits, for instance this one:

Matt 28 Mar 2013 5:58 PM #

@MarkY “Dereferencing null is undefined?  Cool!  I thought it was guaranteed to crash, just like a false assertion or something.  So crashing is the OS guarantee, not the language guarantee apparently.”

Nope. It’s not an OS guarantee either. The OS won’t ever normally allocate memory at address zero, but there’s nothing to stop you telling it to. Try doing “VirtualAlloc(1, 4096, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)” on your pre-Windows8 machine.

In fact, this is the reason why null-dereferences in kernel mode are often exploitable as elevation of privilege attacks. The null-page is mappable and within the user-addressable region of memory, so if the kernel dereferences a null pointer, it reads attacker controllable data.

And btw, this is the reason why on Linux and Windows8+ you can’t map the null-page.

–jeroen

via: The C language specification describes an abstract computer, not a real one – The Old New Thing – Site Home – MSDN Blogs.

Posted in .NET, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Borland C++, Borland Pascal, C, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, C++ Builder, Database Development, Delphi, Development, Pascal, Quick Pascal, Software Development, Turbo Pascal, VB.NET, VB.NET 10.0, VB.NET 11.0, VB.NET 8.0, VB.NET 9.0 | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 1,250 other followers

%d bloggers like this: