Lubo Blagoev's Blog

My thoughts on software and technology

The Inner Dependency Problem


If you think layered application design is good and it's the best way to throw some work at the juniors in you team think again.

cc337885.fig01

If you want to learn more about

  • Inner Dependency Problem
  • Dependency Inversion
  • Service locator
  • Poor's man Dependency Injection
  • Inversion of Control Containers
  • Static Gateway Pattern
  • What's wrong with singletons
  • Boo programming language
  • Decorator pattern
  • Coding to contract rather than concrete implementation
  • Dependency Resolver

there is a very good MSDN article about software component dependencies. I suggest you read it if you haven't already.

Tame Your Software Dependencies for More Flexible Apps (By James Kovacs)

Unfortunately the author missed to mention about Object Builder nor the recently announced Unity Application Block but I think you can investigate further on your own.

Loosen up!
Lubo.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Visual Studio Whidbey/Orcas Tips


You are using Visual Studio for development right? Chances are that you have everything under one solution file. This includes the usual Class library projects, Web projects, Database projects (Data Dude rocks!), Console applications, Smart Client applications, Web Services, Unit Testing, Functional Testing, Silverlight applications just about anything from CLR stored procedures and Drivers to UI applications is under one solution file right? Well not exactly but you got the point. If you have this many projects at one solution file you need an easy way to navigate and find files in it. There are couple of ways you can ease your work.

  • First did you know that if you start typing a files name in solution explorer it will traverse down the tree and select the file that matches. It is the standard type-ahead support for all Windows list views and tree views controls.
  • If you need something more robust you can install SonicFileFinder free add-in. It works great and list all file names containing the search expression.

sonicFileFinderDialog

It also supports wildcards so you can type Ext*Methods for example. For complete list of features see features overview.

  • If you prefer open source you can look at Visual Studio Flat Solution Explorer. It doesn't allow to search by part of a file name though.
  • What if you are in a file and you want to navigate to it in solution explorer. Well that is natively supported. You just need to enable Track Activity In Solution Explorer feature. It is ON/OFF setting unfortunately so you should work either enabled or disabled and sometimes it is irritating since when you switch to the next tab in VS it will jump to the file in solution explorer which may not be your intend. That's why I think it is disabled by default. In any case you can use it by double clicking on it just for the matter of one-time sync. You can also assign a keyboard shortcut through Options->Environment->Keyboard.

TrackActivityInSolutionExplorer

If you want more tips and tricks I suggest you visit Sara Ford's blog (category Visual Studio 2005 Tip of the Week).

I hope this helps. Don't worry, be happy!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Resume VMWare Workstation over Remote Desktop.


I use VMWare Workstation extensively. I use it for all kinds of activities - developing, testing Windows behavior when I do weird stuff, installing software that I need but I know I will never install on my real machine, you name it. It works fine and one of the things I like the most is the pause/resume ability. I need only a couple of seconds to resume a paused machine test something and then pause it again till the next time. Today I needed to do just that but over remote desktop. I logged on my remote machine and started the Workstation Console. When I tried to resume the specific VM I got this error message:

The frame buffer layout of the current display cannot be made to match the frame buffer layout stored in the snapshot.  The dimensions of the frame buffer in the snapshot are: Max width 2560, Max height 1770, Max size 18153472.  The dimensions of the frame buffer on the current display are: Max width 2360, Max height 1770, Max size 16777216.
Error encountered while trying to restore the state of group SVGA from file "C:\Users\****\Documents\Virtual Machines\Win Xp\Windows XP Professional1.vmss".

When I clicked OK it allowed me to preserve my paused state:

Your virtual machine did not resume because of a correctable error. To preserve the suspended state so you can correct the error after the virtual machine is powered off, select Preserve.
To discard the suspended state, select Discard

That was not ok. I needed this machine running. After a while I realized that my remote machine has two monitors so my total desktop size is exactly 2560x1024. What was going on is that my remote desktop session was configured to Full screen and that means only 1280x1024 desktop size. Somehow my paused state depends on that whenever I resume my machine to have the original desktop size I was when I did the pause on the VM. This issue is very easy to fix. I needed to connect with more desktop size to my remote machine.

One way to do it to start "mstsc.exe /span /v:RemotePCName". This way I will get the desktop size of the remote machine.

The other way to do it to specify exactly what is the desired screen size using /w: /h: as parameters. In my case

"mstsc.exe /w:2560 /h:1024 /v:RemotePCName".

This is useful if you have paused a machine and you can't get it up because you have removed a monitor for example. You borrow one of you colleagues machine for a minute and remote connect to your PC specifying the screen size. After the  resume is successful you just go your PCs console or just start a normal remote desktop connection at Full screen.

Note: This works for Remote Desktop Client 6.0.

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

March 16, 2008 15:55 by lubo
Tags: , ,
Categories: Software Development

What's new from MIX08


Microsoft made a ton of announcements at MIX08. I just watched Scott Guthrie at the opening key note. He talked about so many things that I didn't remember them all after I finished watching the movie, so I decided to try summarize them here:

  • Just Released .NET 3.5, VS2008, IIS7, Windows Server 2008. - I don't know what that means since I am using these for a couple of months now. Well except Longhorn 2008. I think they don't count the MSDN subscription downloads.
  • ASP.NET MVC, ASPNET AJAX updated, ASPNET Dynamic Data framework. - Well not yet. Scheduled for "Late this year". I expect this to be this summer since they are talking about couple of releases in that timeframe. Preview releases are available right now though.
  • IE8 beta 1.
    • CSS 2.1 support at the final IE8 release.
    • CSS Certification. They have submitted 702 test cases to W3C test group available at MSDN under BSD license.
    • Performance. vlcsnap-5397866That's one of the reasons why I switched to Firefox. It is interesting why we don't see these kind of comparisons from Microsoft when they release a new product but we see them just when they are releasing the next version of this exact same product. To tell you the through IE 8 beta 1 is more slower than IE7. But hey its a beta 1 remember?

 

 

 

 

 

    • HTML 5 Support.
      • Better history(Back button) support for AJAX sites through HTML 5 hash functionality.
      • Network aware sites through connection events.
      • DOM storage. Save pages locally temporary.
    • IE developer tools, - Updated. Yeah Firefox has couple of them right now.
    • WebSlices - Subscribe to a web page part in IE8. For this to work web sites should specify couple of CSS styles to a div.WebSlices specification is available right now through Open Specification Promise. Samples are also available.
  • Silverlight 2 beta  1 available right now. - I installed that immediately. Like the 1,5+ million others do per day.
    • Rich High Def Video.
    • Adaptive Streaming. Silverlight monitors network bandwidth and automatically adjusts the quality of the video. Very good. I don't know if all those flash video players support that, but in any case this is a must have functionality. Moreover you can plug-in your own algorithm for stream adjustment into the media system.
    • Windows Media Services 2008 for Windows Server 2008 - 3x faster, free and already proved to work in real world scenarios.
    • IIS7 media pack. - Shipped already. Throttling media buffering download to be only seconds ahead of the current video position.
    • Advertising. Making money from your site.
      • Silverlight ad template. A wizard for creating advertising for you to include in web pages.
      • Atlas AdManager. Manage and track your advertising campaign. Many tracking information. Most importantly how much of the video the user have watched. They call it Engagements. Very detailed really.
      • Expression Media Encoder 2. Visually add marker points for dynamically load ads over the video. Very good non intrusion way to show advertisements as overlays on the video the user is watching. XAML overlays also supported.
    • NBC Olympics web site is going to be great. - The main issue was that they have less than 150 days to finish it.
    • Multilingual support JavaScript, VB, C#, IronPython, IronRubby.
    • WPF UI framework support. Layout management. Databinding, Skins and Styles and Animations.
    • Networking stacks. REST, SOAP, WS-*, HTTP endpoints, Cross Domain Networking, Raw Sockets support.
    • Linq query support.
    • Local cache support. That is interesting. Maybe SQL Compact for Silverlight?
    • Higher performance.
    • Small download 4,3MB.
    • Microsoft is partnering with Novel to deliver Linux support for Silverlight. That is great. Most probably it will kill Moonlight project.
    • Built in Controls. Available as open source. You can modify them as you see fit. Available already.
    • Testing framework for UI controls and for non UI code. 2000 unit tests. Available already as open source.
    • Visual Studio 2008 Tools for Silverlight Beta 1 and Expression Blend 2.5 March Preview support. These Expression tools will never come out of beta. Don't you think?
    • Silverlight Deep Zoom functionality available for you to use it on your web sites. See it in action on Hard Rock Memorabilia.
    • SharePoint Silverlight extensions. Yeah! I am very excited about this specifically, cause man that software will really survive the sun apocalypse. In fact I think this Silverlight thing was invented for this in the first place.wink
    • Mobile devices support. That's huge. How in the world we are going to catch up with iPhone without this.
    • Silverlight support on Nokia Symbian S60, S40 and Internet Tablets OS. That's fantastic news! Do you remember the Silverlight's code name? WPF Everywhere anyone? Now what Nokia needs is a nice Singularity OS for mobile devices to get rid of the Symbian+Java crap running on in.
  • WPF improvements.
    • More controls.
    • Streamlined .NET setup. .NET 3.5 is installed by default on Windows Server 2008 but is not installed by Vista SP1 setup.
    • Startup performance.
    • Graphics Improvements. Offload more onto the GPU. - Will be available as a summer update.
    • Custom graphics effects. Onto the GPU also. Custom effects for you to implement. Over pictures, movies and controls.

That is a very long list of announcements. There are at least 15 things I want to test right now but I know I will skip it. As always the time that we have is very limited. The next set of Betas and CTPs are coming very soon. That's how's live on the verge of technology.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Vista SP1 broke my blog


Like every windows developer I installed Vista SP1 as soon as it came out on MSDN Subscriptions. I was happy and confident to know that the most of the glitches that bugged me till today will be gone. Service Pack 1 installed without any issues. (I even installed it on my work PC over remote desktop, so the next morning I come to work I wont have to wait for it. Pretty cool).

It was just when I tried to open my blog that I realized it is not working. I got Error 503 Service Unavailable response from the server. A quick look showed that the Application Pool for my blog was failing to serve the first request and logs the following error in Event log.

The worker process failed to initialize correctly and therefore could not be started. The data is the error.

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
 <System>
   <Provider Name="Microsoft-Windows-IIS-W3SVC-WP" Guid="{670080D9-742A-4187-8D16-41143D1290BD}" EventSourceName="W3SVC-WP"/>
   <EventID Qualifiers="49152">2276</EventID>
   <Version>0</Version>
   <Level>2</Level>
   <Task>0</Task>
   <Opcode>0</Opcode>
   <Keywords>0x80000000000000</Keywords>
   <TimeCreated SystemTime="2008-02-21T21:43:34.000Z"/>
   <EventRecordID>36822</EventRecordID>
   <Correlation/>
   <Execution ProcessID="0" ThreadID="0"/>
   <Channel>Application</Channel>
   <Computer>CONROE</Computer>
   <Security/>
 </System>
 <EventData>
   <Binary>05000780</Binary>
 </EventData>
</Event>

So the data is the error. This error in words is 80070005. I was one Windows SDK start away from finding out what that means. I searched for this number in the SDK and found out that this is a Standard COM error "E_ACCESSDENIED 80070005 General access denied error." So I realize I am dealing with a security issue. What was the exact resource that my App Pool was trying to connect and failed? Like Mark Russinovich would do I started Process Monitor to look for more detailed information since the report was totally non comprehensive. Working with Process Monitor is very easy just watch TechEd IT Forum 2007: The Case of the Unexplained... movie where Mark shows some more stuff. The most important rule for Process Monitor is know what you are looking for. In my case that was an Access Denied operation result in the Result column. This would be on a process with credentials that my app pool was configured to work with. So I highlighted all processes that have this user credentials. After that it was easy to identify the operation that failed - the selected row on the screenshot.

Process Monitor

The process's that runs my blog had no read access to C:\Windows\System32\inetsrv\config\schema directory. This directory is used by IIS to save its settings. So I changed the security settings to allow my user credentials to read from that directory and voila my blog is up again.

By the way if you watch the The Case of the Unexplained movie you will hear Mark Russinovich say that he strives to remove all hexadecimal error message from user space. I guess Mark and Microsoft as a whole must treat Event log messages the same as user level MessageBoxes. The event log message was not detailed at all and whoever wrote that COM logging should add the event error description not just writing a simple error code to the log.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5