Articles from April 2008

IE7 on Windows Server 2003

By Michael Flanakin @ 6:08 AM :: 2620 Views :: Architecture :: Digg it!

Single sign-on (SSO)

I've been working on a single sign-on (SSO) solution for a client for a while and I've run into an issue with IE7 on Windows Server 2003. To get SSO to work, there are a number of issues you need to be aware of -- I'll probably write a post on that later. In my experience, the root of all SSO issues is either Kerberos delegation or DNS configuration. Unfortunately, due to the default configuration of IE7 on Windows Server 2003, the browser won't send a Kerberos ticket to the web server. Obviously, SSO won't work without this. If you're an admin, you can go into IE options and toggle a few settings to get this to work, but when you're using test users without admin rights, you can't.The problem is that the default configuation does not accurately determine if the website you're browsing to is in the local intranet zone.The following registry changes will fix the issue.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap]
@=""
"AutoDetect"=dword:00000001
"UNCAsIntranet"=dword:00000001
"ProxyBypass"=dword:00000001
"IntranetName"=dword:00000001

I'll go into this in more detail when I write the post I mentioned. To apply the change, you can either do it manually or save the above to a file ending in .reg and then double-click that to update the registry.


Extending the Web into the Browser

By Michael Flanakin @ 5:06 AM :: 1256 Views :: Technology :: Digg it!

Today, web applications are fairly self-contained. This is definitely a good thing, but is it time to take the next step? Web 2.0 is about extending past your own boundaries, essentially enabling software as a service, in a sense. What I'm talking about is exactly that -- extending the web past your boudaries and into your users', with the express intention of enhancing their experience. Think about how much you can enhance a user's experience with such integration. While today's browser is capable of such an experience, achieving it easily is not possible. With 4 major browsers and countless others (I can think of at least a dozen), developers are forced to target a select number of clients. This typically causes developers to either completely avoid this approach or standardize on one browser, which I think we can all agree is not desirable.

I started this post in January and, now that the IE8 beta is out, we see some of what I'm talking about in WebSlices. The problem here is exactly what I mentioned before -- nonstandard implementations. In the same breath, standards bodies are slow in this regard. For instance, we wouldn't have AJAX if it weren't for the nonstandard implementation in IE4 (or was it 5?). Either way, I want more. I want interactivity, not just a real-time snapshot of information. For instance, if I have a mapping aplication, I want to take all of the zooming and searching out of the web page and let the web content strictly focus on the mapping elements. Heck, for any application, separating primary navigation would be nice. I'm more concerned with easily enhancing the app, not just moving contextual controls up one level, tho.


One Use for Extension Methods

By Michael Flanakin @ 5:44 PM :: 1272 Views :: .NET, Development :: Digg it!

Microsoft .NET

I like extension methods. Some people suggest you avoid the feature, which I believe is understandable, but the more I think about it, the more I want to use it. Don't get me wrong, I'm not using them all over the place, but when they make sense, it can make your code much cleaner.

As you may know, I'm working on custom code analysis rules to enforce coding standards. To make the rules testable, I decided to front the code analysis types with my own object model. To do this, I created a factory to create my types -- CodeItemFactory.Create(Member). While creating a new rule, I wanted to see if the current member had a sibling member with a specified name and then return that. At first, I started to add a new method to the CodeItem class, but then I realized I'd have to reference the CodeItemFactory class. While I'm in the same assembly, I didn't like the idea of putting this logic into the domain object and creating a circular dependency. Plus, since the code analysis framework isn't "officially supported," there are no promises on what will be available in the future. Keeping my integration code separate is just a good idea. So, I ultimately decided to create an extension method to do what I needed -- CodeItemExtension.GetSibling(this CodeItem, string). This enabled me to have a clean code implementation and keep my purist ideals of separating integration code -- codeItem.GetSibling(memberName).

There are plenty other reasons to love extension methods, but I just wanted to share this because I feel like it's a very nice solution that keeps life simple.


PowerShell Tip: Handling Errors

By Michael Flanakin @ 5:06 AM :: 2656 Views :: En Español, PowerShell :: Digg it!

PowerShell

As you get into writing functions, you'll undoubtedly hit a scenario where a command may return an error. To buld the most robust scripts, you simply need to keep one standard argument in mind: -ErrorAction.

-ErrorAction tells PowerShell what to do if the command returns an error (obviously). There are four options: SilentlyContinue, Stop, Continue, and Inquire. As you most likely deduced, these continue without displaying the error, stop further processing, continue with the error displayed, and ask the user whether to continue, respectively. The default is Continue, but my favorite is SilentlyContinue because I would rather handle errors myself. If you're really lazy efficient, you can even use -EA 0. Since -ErrorAction is an enumeration, you can use this to specify any value, 0-3 (based on the previously mentioned order).

Sugrencia PowerShell: Control de Errores

En Español

Al crear funciones, usted encontrará un panorama cuando usted conseguirá un error. Para construir las escrituras robustas, recuerde un argumento: -ErrorAction.

-ErrorAction indica qué hacer si el comando devuelve un error (obviamente). Tiene cuatro opciones: SilentlyContinue, Stop, Continue, y Inquire. Como deduce lo más probable es que, estos continuar sin mostrar el error, detener el procesamiento, continuar con el error muestra, y preguntar al usuario si desea continuar, respectivamente. El estándar es Continue, pero mi favorito es SilentlyContinue porque tengo gusto de manejar mis errores. Si esta perezoso eficiente, puede utilizar -EA 0. Desde entonces -ErrorAction es un enumeración, puede utilizar este método para especificar cualquier valor, 0-3 (de acuerdo con la orden previamente mencionada).


Testing Custom Code Analysis Rules

By Michael Flanakin @ 3:55 AM :: 1951 Views :: .NET, Development, Microsoft, Predictions, Tools/Utilities :: Digg it!

Microsoft .NET

Over the years, I've been asked to put together coding standards again and again. The nice thing about this is that it enables me to pull out the old docs and touch them up a little. A year or two ago, I heard something that made a lot of sense: developers never really read coding standards and, even if they do, they don't usually adopt them. Let's face it, if you don't adopt a standard as your own, you're not going to use it. The only way to ensure the standard is applied is to catch the problem before it gets checked in. I tried a VS add-in that attempted to do this as you type, but it wasn't quite as extensive as I want, but I grabbed onto the concept. For the past year, I've been wanting to start this and have finally decided to do it.

As I sat down and started to investigate writing custom code analysis rules, I asked myself how I was going to validate them. After hacking away at one approach after another, I started to realize I wasn't going to get very far. Apparently, with the latest releases of Visual Studio and FxCop, there's no way to create the objects used to represent code. After talking to the product team, the official position seems to be that, since custom rules aren't "officially supported," they're not going to support their testability. I'm not sure who made this decision, but I think it's a bad one. Of course, I say this without knowing their plans. Well, not completely, anyway.

It's not all bad news, however. It turns out there are hopes to start officially supporting custom code analysis rules in the next major release, Visual Studio 10. Nothing's being promised at this point, it's just something the team would like to deliver. I should also say that the upcoming Rosario release isn't the major release I'm referring to. I'm expecting Rosario to be a 9.1 release that will probably hit the streets in early 2009. That's a guess, tho. If that's true, the VS 10 release probably wouldn't be until 2011. All I can really say about it is that it'll be a very exciting release. I can't wait to get my hands on a beta. Speaking of which, some of the goals they have for the product will make beta testing much much easier... I'm talking about a hugely evolutionary change, if not revolutionary, considering where the product is today. That's all I can really say, tho.

Back to the point, since there's no realy testability of the code analysis framework, I decided to create my own object model. The part I'm missing, obviously, is the factory logic that converts code analysis types to my types. I'm hesitant about this approach, but it's working so far. Hopefully, I'll have something to deliver soon. I keep bouncing around, tho, so at this point, I want to deliver a release with only naming conventions. That release is mostly complete, I just need to get approval for a distribution mechanism. If I don't get that soon, I'll just release it on my site.


So Long, Click to Activate

By Michael Flanakin @ 5:27 AM :: 2080 Views :: Technology, Microsoft, En Español :: Digg it!

Internet Explorer: now with more sexy!

At long last the "click to activate" message will be going away in IE. This was brought about because of a much debated lawsuit Eolas filed against Microsoft for patent infringement. Despite having support from the W3C to prove prior art, Microsoft still lost and had to change IE and pay millions to the company. These things are ridiculous. I'm not against software patents, but stuff like this annoys me. Seriously, how long was IE around with ActiveX before Eolas filed the lawsuit in 2004? It's not like the browser just snuck up on everyone. Anyway, I'm glad to see it go. Good riddance. Now IE is that much more sexy

El Titulo en Español

En Español

Finalmente, el "clic para activar" mensaje de IE desaparecerá. El mensaje fue creado porque el mucho discutió pleito de Eolas contra Microsoft para el incumplimiento de patente. A pesar de tener ayuda del W3C para probar arte anterior, Microsoft perdió y tuvo que cambiar el IE y pagar millones. Estas cosas son ridículas. No soy contra patentes de programas de computadoras, pero la situación me molesta. ¿Cuantos años IE tiene con ActiveX antes del pleito de Eolas en 2004? IE no hizo furtivamente para arriba en cada uno. Estoy alegre verlo ir. Buena liberación. Ahora el IE es que mucho más atractivo


What's Next for .NET

By Michael Flanakin @ 5:02 AM :: 1379 Views :: .NET :: Digg it!

.NET

Looks like we'll see an update to .NET this year. I was hoping this was going to be a .NET 3.6 release, but no such luck. Instead, it'll be .NET 3.5 SP1. With all the changes going into the release, it seems like more of a point release, but whatever. With all the version shennanigans .NET has been going thru over the last three years, it would only confuse people more, so it's probably a good thing. WPF seems to be getting the most updates. I have to wonder whether Silverlight 2 is pushing those changes. I'm also not sure whether this will be art of the VS Rosario release. I don't think it will unless Rosario comes out sooner than expected. If they are separate, this will be the first VS release that doesn't come with a new version of .NET in over a decade.


WPF Performance Tips

By Michael Flanakin @ 9:52 AM :: 8935 Views :: .NET, Patterns & Practices :: Digg it!

Microsoft .NET

First off, let me say that this list isn't mine. I saw it on a presentation and wanted to make sure I had it to reference later. Enjoy!

  1. Reduce unnecessary invocations of the layout pass -- update a Transform rather than replacing it
  2. Use the most efficient Panel where possible -- don't use Grid if you need is Canvas
  3. Use Drawing which are cheaper than Shape objects
  4. Use StreamGeometry, which is a light-weight alternative to PathGeometry for creating geometric shapes
  5. Use DrawingVisual to render shapes, images, or text
  6. If you need thumbnail images, create a reduced-sized version of the image
    Note: By default, WPF loads your image and decodes it to its full size
  7. Decode the image to desired size and not to the default size
  8. Combine images into a single image, such as a film strip composed of multiple images
  9. Set BitmapScalingMode to LowQuality for smother animating when scaling bitmap to instruct WPF to use speed-optimized algorithm
  10. Set CachingHint when possible, to conserve memory and increase perf
  11. Brush selection is critical to good performance; don’t use a VisualBrush or DrawingBrush when an ImageBrush or SolidColorBrush would be sufficient
  12. To draw complex, static vector content that may need to be repeatedly re-rendered, consider rendering it into a RenderTargetBitmap first and drawing it as an image instead
    Note: Rendering images is usually faster than rendering vector content
  13. Remember to clear event handlers to prevent object from remaining alive (see this post on finding memory leaks
  14. Use Freezable objects when possible to reduce working set and improve perf
  15. Remember to virtualize
  16. Share resources -- if you use custom controls, define control resources at the application or window level or in the default theme for the custom controls
  17. Share a brush w/o copying by defining it as a resource
  18. Use static vs. dynamic resources
  19. Don’t use FlowDocument element when all you need is a Label or TextBlock
  20. Avoid binding to Label.Content property, use TextBlock instead if source is frequently changes.
    Note: String is immutable, so Label object’s ContentPresenter must regenerate new content
  21. Don't convert CLR object to XML if the only purpose is binding
    Note: Binding to XML content is slower than CLR objects
  22. Always prefer binding to an ObservableCollection<T> vs. List<T>
  23. When a brush is used to set the Fill or Stroke of an element, use the brush's Opacity value rather than element's Opacity property
  24. Disable hit testing (IsHitTestVisible = false) when possible
    Note: Hit test on large 3D surfaces is expensive

If you're hungry for more, feel free to dig thru the Optimizing WPF Application Performance section on MSDN.


Latest on Windows 7

By Michael Flanakin @ 6:24 AM :: 1933 Views :: Technology, Microsoft, Predictions :: Digg it!

Windows 7

There's been a lot that's come out regarding the next version of Windows, code-named Windows 7. Let me try to summarize what I've seen...

When it Will Release

First, let me touch on the release date, since that's been heavily debated. The initial speculation was that Windows 7 would be released in 2010. Later, rumors of a 2009 release cropped up. It wasn't too long until Microsoft released comments stating that Windows 7 would take three years to develop. Speculation from the field translated this to 2011 release. Of course, that was coupled with some doubt. As if that wasn't enough, Bill Gates recently stated that the team is targeting first quarter 2010. I'm sure the Windows team is slapping their heads wondering why he shared this, but it's too late, now. I believe the team has been purposefully quiet about the release for two reasons: (1) to ensure the release was on time; and, (2) to lessen the impact on Vista sales. I don't blame them. If you ask me, I think we'll be looking at an early 2010 release with hopes that it'll be ready in 2009. Of course, I have nothing to back that up, so it's merely a blind prediction.

How it Will Release

Microsoft has had a vision of releasing components of Windows independently for the past 6+ years. This was mainly related to the server operating system, but it's still a great feature for the client. With the software+services push, some are speculating there will be a piece-meal release methodology. I don't expect us to see this with Windows 7, but it's coming. There have also been rumors of subscriptions, which is another area Microsoft has been interested in for years. In my mind, this is more of an issue with society, than Microsoft. If the community would grasp the concept, Microsoft would definitely go there. I don't know if we'll see that in the next release or not, but it's another thing I see coming eventually.

What it Will Include

A while back, there were some hints to what was going to be included in Windows 7, but it now lookse the release is picking up a new set of pillars focused on design and usability: specialized for laptops, designed for services, personalized computing, optimized for entertainment, and engineered for ease of ownership.Taking it all in, the core concepts seem to be around ease of use, connected computing, and security -- pretty much taking the next step after Vista. I see this being evolutionary, as opposed to the revolutionary version of Windows I hoped this was going to be. I guess I can hold onto those hopes for the next release.

With an increasingly mobile workforce and consumer population, tuning the OS for laptops is going to be a big win. With this, they'll be looking at data security, responsiveness, touch/tablet interfaces, wireless connectivity, "on demand" access to all your information, and power management. Most of these are pretty obvious. The only one I had to take a second look at was "on demand" access. This is basically about either storing your information in the cloud or ensuring access to it, no matter where it may live. Windows Live is how we're going to get there. This pretty much says that Windows 7 will definitely have some Windows Live integration. I can already see the EU beckoning for "justice."

With the "on demand" component of the last pillar, we have a good transition into the second, designed for services. This one's obvious as well. Windows will focus on remaining up-to-date (as in with patches), worry-free upgrades, Windows online , help and community, family-friendly web experience, gadgets, and in-box application improvements. We already have most of what's here. I think the pillar is mostly about providing a more integrated experience. I am curious how Microsoft plans to achieve "worry-free upgrades." That's going a long way. Apple has that today, so it's not entirely out of the question, but I think Apple gets it thru customer confidence, not by technical prowess. Lastly, I'm interested in the application improvements. I've been using custom apps like Notepad2 and Paint.NET for a while now and it'd be nice to have something better than what was delivered in Windows 95 built-in. I heard about upgrades to these apps last year, but haven't seen what's come of that. The AeroExperience website posted these images. I hope this isn't it, tho. This is a bit minimal.

Calculator in Windows 7 Paint in Windows 7

Personalized computing is something that will really bring Windows back to the consumer. To achieve this, Microsoft will target customization, internationalization, access anywhere, secure roaming, and home network management. Again, these are pretty self-explanatory.

The next pillar is about high definition graphics, media streaming, better playback, TV on Windows, and audio improvements. This is another area that is pretty much just enhancing what we already have today. I'm mostly interested in the TV on Windows scenario. This is already available, but very limited today. I consider this to be part of the Media Center vision, but Microsoft seems to have a few different products in the area. I hope there will be some consolidation here, but that may not make complete sense.

The last pillar is about ownership. Microsoft will put a strong emphasis on diagnostics and data recovery, lessening the fear of new applications by decreasing the need for administrative access, improved upgrade experience, administrative productivity and security enhancements, devices that "just work," quick/clean out-of-the-box experience, reduced management time/cost, and improved data security. We've seen a lot of improvements in this area with Vista and there's still some room to grow. If you haven't jumped on-board with Vista, you're in for a vastly improved experience and it looks like Windows 7 will be even better.


PowerShell and Project Euler

By Michael Flanakin @ 1:40 PM :: 1816 Views :: Development, PowerShell :: Digg it!

PowerShell

So, my "daily" PowerShell tips haven't gone like I imagined. I have a list of topics to post. I just haven't had the time to type them all out. Either way, I'm still stuck on PowerShell. As a matter of fact, I just heard about a geeky website, Project Euler, which is dedicated to math and programming problems. When I first heard about it, I was thinking it sounded like a great way to hone your performance tuning skills. After trying the first problem, I'm not sure that's the case, but the problem was very simple. As a matter of fact, I solved it with a one-liner. If you're actually interested in solving it yourself, you may want to ignore this post. Then again, it's pretty simple.

I'll probably check out more of these. I'm not sure if I'll post the andwers or not, tho. Then again, as you progress, they get more and more complicated. If you're a sucker for pain, you can jump to one of the more complicated problems. I don't know how hard they'll be, but I'm sure it'll take longer than the 2 minutes this one took me.

Problem 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

My Solution

All I did was loop tthrough all numbers and added the number to a running tally if it was divisible by 3 or 5. Gee, that's pretty much what the problem statement was. Like I said, this one is pretty simple.

$sum = 0; ForEach-Object ($i in 3 .. 10) { if ((($i % 3) -eq 0) -or (($i % 5) -eq 0)) { $sum += $i } }; Write-Output $sum

What really surprised me was that this script ran from 3 to 1000 in 0.0156 seconds. I don't know what typical numbers are, but I was expecting it to take longer. For learning purposes, the aliases for ForEach-Object and Write-Output are foreach and echo.


Revisiting UpdateVersion

By Michael Flanakin @ 4:51 AM :: 1774 Views :: .NET, Development, Configuration Mgmt, Tools/Utilities, PowerShell :: Digg it!

UpdateVersion

It's amazing what sticks and what doesn't. Back in Aug 2004, I caught wind of UpdateVersion, a tool Matt Griffith wrote to update version numbers in AssemblyInfo files. The tool is pretty simplistic, but provides an absolute benefit. Every couple of months, I get asked for a copy of the changes I made... despite the fact that they've been available online for years. Nonetheless, it's about time I created a project on CodePlex for the utility. At this point, I don't really expect to make any changes to it, but I will if someone sees value in it. If I were to make any changes, I'd probably go ahead and convert it to .NET 3.5 and possibly even add a PowerShell cmdlet.


Adobe's Air Mistakes

By Michael Flanakin @ 7:31 AM :: 1267 Views :: Development :: Digg it!

Adobe Air

Air is Adobe's initial foray into desktop development. As you might imagine, Air is essentially Flash for the desktop. I'm not impressed at all. Air gives you 3 development options: Flash, Flex, or HTML.

Flash is primarily used by designers for ads, video playback, and small games -- notably, no "real" development. Seriously, what intelligent person is going to develop a significantly sized app with ActionScript?

Flex seems to be the preferred method for creating Flash and does so using a proprietary markup syntax. Flex still uses ActionScript, tho, which begs the question: who in their right mind would use this for anything more than a trivial app?

Finally, the HTML option gives us something feasible to work with. Here's a technology all web developers know and love... oh, wait... We don't love HTML. As a matter of fact, most devs I know have been complaining about it for the last 10 years. I've always been one to embrace JavaScript, but it's far from ideal. Actually, I think that's what most devs hate more than HTML. This is why there's controversy surrounding the EcmaScript standard update. All that aside, it's the only feasible platform for Air development, in my mind. Because of this, I think Air is flawed.

If I was Adobe, I'd latch onto a more powerful platform, like Java -- I'd say .NET, but we all know that won't happen. I don't see Air going too far due to the lack of strong underpinnings. Then again, I have been surprised at the apps that have picked up on it. Perhaps HTML support is more about migration strategy than a quality development platform. I'm definitely interested in seeing where this goes. With Silverlight 2.0 on its tails, Adobe is under the gun to make some serious movement in this arena.


IBM Banned from Federal US Contracts

By Michael Flanakin @ 5:50 AM :: 1295 Views :: Technology :: Digg it!

IBM banned from US federal contracts

Someone stopped by my desk yesterday and informed me of some interesting news: IBM has been banned from receiving federal contracts in the US. Apparently, this is due to questions behind how they obtained an EPA contract. This is a huge deal for IBM and I can't see it sticking for too long. I find this very interesting, because IBM has a huge footprint in the US federal space. I also can't help but wonder, if this does stick around for any significant period of time -- even just a few months -- that's not only going to hurt IBM, but it will most likely boost MCS engagements, which is what really touches home, for me.

Despite the fact that there's no love lost for this, it reminds me of a comment someone made about how corporations don't lay off people, people lay off people. I hate when I see stuff like this because you know... or, at least you hope the company isn't stupid enough to have some sort of policy to mandate illegal or unethical practices. I feel the same way about governments: governments aren't evil, people are. It drives me crazy when people make blanket statements about groups of individuals without recognizing they are, in fact, individuals.