Last 24 Comments

re: Dynamic Types and DynamicObject References in C#
Yesterday @ 8:48 pm | by Rick Strahl

@Duncan - Performance is decent but still significantly slower than direct access. When I wrote up the DynamicDataReader post a while back I did a bunch of performance testing comparing direct data access using the Reader and the dynamic reader instance and even with warm up (initialization) removed from the call the performance difference was nearly than 2:1. There's definitely a tradeoff for using dynamic even if it does provide some really nice functionality and cleaner code.
re: jQuery CSS Property Monitoring Plug-in updated
Yesterday @ 7:22 am | by kadın

Maaaan. You repeatedly keep coming up with cool shit! Keep it up!..
re: Dynamic Types and DynamicObject References in C#
Yesterday @ 6:10 am | by Duncan Smart

> dynamic object access has quite a bit of overhead and is definitely slower

Only the first time you hit a dynamic member, at this point it compiles the call site so that subsequent accesses should be very fast. Hence Rob Conery's dynamic-based Massive "ORM" performs very well compared to Dapper, etc.
re: Making Sense of ASP.NET Paths
Yesterday @ 5:26 am | by Serguei

When I use synonyms for may base domain - how can I get correct URL?

For example...

base domain: site.de
synonym: site.com

I open "site.com" and I see in my browser "site.com".

But!

AbsolutePath @(HttpContext.Current.Request.Url.AbsolutePath)<br />
Authority @(HttpContext.Current.Request.Url.Authority)<br />
DnsSafeHost @(HttpContext.Current.Request.Url.DnsSafeHost)<br />
Host @(HttpContext.Current.Request.Url.Host)<br />
OriginalString @(HttpContext.Current.Request.Url.OriginalString)<br />

All are "site.de"
re: Dynamic Types and DynamicObject References in C#
Thursday @ 8:17 pm | by Rick Strahl

@Steven - Clay looks interesting. I have to investigate a little further. Not sure how useful it is to cast dynamic to an interface. That still means that you have to know up front what you're working with - if you know then you might as well be using a static type, no? I can't think of a use case where that would matter (unless you can also construct the interface on the fly).
re: Web Browser Control – Specifying the IE Version
Thursday @ 8:03 am | by Phillip

I found this:
<h1>Opt-In to High DPI Behavior for Web Browser Controls (WebOCs)</h1>
<span>In order to preserve compatibility with previously developed WebOCs, by default Internet Explorer 8 does not render the web content of WebOCs using the Internet Explorer 8 High DPI behavior, but rather uses the Internet Explorer 7 behavior, which scales up fonts specified in absolute values, such as points. To take advantage of the Internet Explorer 8 High DPI behavior in your programs, you need to use a DOCHOSTUIFLAG called DOCHOSTUIFLAG_DPI_AWARE. You use this flag by using the method GetHostInfo, which has a DOCHOSTUIINFO structure as one of its parameters. In turn, DOCHOSTUIINFO has a operator DWORD called dwFlags as one of its members, that can consist of one or more DOCHOSTUIFLAG values. You must include DOCHOSTUIFLAG_DPI_AWARE in dwFlags in order to take advantage of the Internet Explorer 8 High DPI behavior in your WebOC.</span><br /><br />
 
<span>The quick and easy way to simulate how the HTML content of your WebOCs will appear once opted -in to the High -DPI behavior is to open the equivalent HTML content (composed in an HTML file) in Internet Explorer 8, and simply check out the rendering at the equivalent zoom settings (120 DPI to 125% zoom, 144 DPI to 150% zoom). We do recommend that you test out the WebOC in actual High DPI scenarios to be completely sure the HTML content renders as you hoped.</span><br /><br />


here: http://msdn.microsoft.com/en-us/library/ie/cc849094(v=vs.85).aspx
Is there one of those flags to switch co IE8 as well?
re: Dynamic Types and DynamicObject References in C#
Wednesday @ 1:23 pm | by Rick Strahl

@Nadav, thanks for the feedback. I was thinking about that last night and ended up not changing it at the last minute. Went through this morning and replaced most of the static references with strongly typed.

@John, you're totally right that shouldn't compile - my fat fingers. It was supposed to be the strongly typed foo.Bar property instead foo.Name. Fixed in the article.

I really should abstain from posting really late at night :-)
re: Dynamic Types and DynamicObject References in C#
Wednesday @ 9:50 am | by John Bledsoe

A question about this code:

dynamic fooDynamic = new DynamicFoo();
fooDynamic.NewProperty = "New Property Value";             
DynamicFoo foo = fooDynamic;
foo.Name = "Rick";


When I try to run this it doesn't compile, which is what I would expect based on your description of how statically-referenced types are handled differently than dynamically-referenced types. I couldn't tell from the article though whether this code was supposed to work or not.

Can you clarify that this should *not* compile, since you cannot set the non-existent Name property on a statically-referenced instance of DynamicFoo?

Thanks,

John
re: Dynamic Types and DynamicObject References in C#
Wednesday @ 6:30 am | by Steven Berkovitz

Have you had a chance to check out Clay (http://clay.codeplex.com/)? It has some neat features like being able to cast any dynamic object to an interface and then access properties with type-checking, etc.
re: Dynamic Types and DynamicObject References in C#
Wednesday @ 3:51 am | by Nadav

Nice article.

Just a small remark,
You're using 'static properties' to refer to the properties defined on the class, maybe something 'strongly typed properties' would be better since static properties means something else...

Nadav
re: jQuery.position() on Invisible Elements fails
Tuesday @ 12:32 pm | by Rick Strahl

@Tahir - You can't get a position value for an inline element reliably (nor would you want to because the element will flow with resizing/movement etc.). One thing you can do is make any element positional first (position: absolute) then use position on it.

FWIW, it's a really bad idea to try to manipulate an inline element like <br> and treat it as positional. Use a div or other block element. If necessary wrap whatever you have into a block element.
re: jQuery.position() on Invisible Elements fails
Tuesday @ 3:06 am | by Tahir

Please suggest any solution for using jquery.position() for <br> element.
it gives me the correct value in firefox but gives 0 in chrome.
please help me.
Thanks in advance
re: Collection property Hell on an ASP.NET Server Control
Tuesday @ 12:14 am | by Marzban Doctor

Hi Rick,
I need to create a custom server control with collection properties for the following markup... This server control parses content retrieved from a CMS for tokens delimited by "[[" and "]]" chars. The markup looks like this...
<ww:ContentBlock ID="CB1" runat="server" ContentBlockName="">
    <DataTokens>
        <ww:DataToken ID="CB1DT1" runat="server">
            <%= ListingObject.ListingTitle  %>
        </ww:DataToken>
        <ww:DataToken ID="CB1DT2" runat="server">
            <%= ListingObject.ListingDescription  %>
        </ww:DataToken>
    </DataTokens>
</ww:ContentBlock>


My question is, how do I make the parser bind the "ListingObject" page property from the code-behind to the custom control's collection property???
Thanks,
Marzban
re: Restricting Input in HTML Textboxes to Numeric Values
Monday @ 11:40 pm | by Ares

this program works fine except that it doesn't allow to enter Numeric keypad values from laptop as we have to press Fn key to use those on laptop
re: .NET 3.5 Framework Distribution Size
January 29, 2012 @ 9:02 pm | by LadyD

I realize that this is an old thread, however the topic still remains a problem.
I am neither a developer, nor a purveyor of apps, however I am a user of them.
Speaking as a consumer and as one of the 100 million Americans who do not have access to broadband at home, (and/or in my case, a reasonably priced mifi. sevice) I will say this; The NET 3.5 Framework download is of a completely unacceptable size for all dial-up users. This behemoth would take me 12 hours, and 8 minutes to download if I started with a clean machine, no other programs running and a good tail wind. Even then there’s no guarantee that a file or two wouldn’t be corrupt or connection lost.
100 million of us, that is currently about 1/3 of all Americans. That amounts to more than a wee bit of cheddar that the MS lab rats in demographics must be keeping for themselves. Needless to say, there are several apps I won’t be using on my PC anytime soon.
re: IE9 not rendering box-shadow Elements inside of Table Cells
January 27, 2012 @ 3:17 pm | by Rick Strahl

@Sharky - of course. It works if it's not inside of tables. As others pointed out you can apply the border-collapse style to any control that sits above the image (or other control) that requires the box shadow.
re: jQuery Time Entry with Time Navigation Keys
January 27, 2012 @ 2:09 pm | by E.R. Gilmore

Rick,

I'm now working at a place that does a lot of time-based queries. Would it be hard to modify this to set seconds too? Would you have to do it with another key for the seconds, like Ctrl-Up/Down?

Thanks,

E.R.
re: IE9 not rendering box-shadow Elements inside of Table Cells
January 27, 2012 @ 1:25 pm | by Sharky

Have you tried the code without using tables?
re: ASP.NET Routing not working on IIS 7.0
January 27, 2012 @ 9:20 am | by James McCormack

txcraig - You rock, we couldn't find information about that KB hotfix anywhere! Solved our MVC 3 problem with 404 errors on Windows Server 2008 (non R2).
re: Unable to cast transparent proxy to type <type>
January 26, 2012 @ 3:01 pm | by Rick Strahl

@Oison - excellent resources! Oldies but goodies - the basics still matter!
re: RequestValidation Changes in ASP.NET 4.0
January 26, 2012 @ 11:53 am | by Steve

hmm..nearly a year later i see... but thanks Jeremy. That was the answer I was looking for! Cheers
re: LINQ to SQL and Serialization
January 26, 2012 @ 11:20 am | by Nate

I have tried the following 2 things to avoid this circular reference error:

- Added [System.Xml.Serialization.XmlIgnore] to all EntitySet<t>
- Set all child associations to Internal

I double-checked that I got ALL of them. In fact I wrote a little parser to go through and parse and update the items, because it's about a thousand lines of xml.

Neither of these approaches worked. I see some suggestions that look interesting but would require a hundred hours of refactoring my code to implement; not an option for me.

It's driving me crazy that I've seen lots of posts saying that 1 or both of the above items worked for them, yet it doesn't work for me. I've triple checked, read lots of articles, recompiled, tried variations on different suggestions. Nothing.

Anything I might have missed?
re: IIS 7 Error Pages taking over 500 Errors
January 26, 2012 @ 9:12 am | by Dating

Just wanted to say that is this affects other status codes as well.
You've saved us alot of work with this article.


West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2012