Welcome to RightHand's community place Sign in | Join | Help

First signs of Direct3D life on HTC TyTN II!

Guys at xda-developers.com achieved a breakthrough in HTC TyTN II missing (3D) graphics acceleration technology. In fact they achieved to cook up a proof of concept Direct3D driver that is able to accelerate windowed application on HTC's original WM6.1. Now is clear that MSM7200 inside TyTN II is capable of 3D acceleration if nothing else. Excellent work, chefs!

If you are in the mood for "miracles" then read the forum and download the drivers from HTCClassAction.org.

Posted by Miha Markic | 0 Comments
Filed under:

Creating wrappers for sealed and other types for mocking

Did you ever wanted to mock a sealed class or non-virtual methods? Unless you are using TypeMock you are in for some coding as there is no easy way to mock them just like that (I am fiddling with MOQ but AFAIK no mock framework is capable of mocking sealed classes with exception of TypeMock). The general pattern I see is to create a wrapper class that implements an interface (you have to create that interface, too, most of the times). Let's see an example with a class Tubo:

public class Tubo { public void SomeMethod() { } public int SomeProperty { get { return 1; } }

To be able to mock this class you have to create ITubo interface and a TuboWrapper class like this:

public interface ITubo { void SomeMethod(); int SomeProperty { get; } } public class TuboWrapper: ITubo { private Tubo tubo = new Tubo(); public void SomeMethod() { tubo.SomeMethod(); } public int SomeProperty { get { return tubo.SomeProperty; } } }

It sounds like highly boring and time consuming exercise, doesn't it. Specially if you have to wrap a class rich with methods and properties. One could argue that you should think before creating non-mockable types. True, but one can't help when dealing with non-user types (i.e. .net framework types).

One solution would be to go duck typing as Phil Haack explains. There is also a library that enabled such typing. However, there are two arguments against duck typing:

  • slight performance hit
  • you still have to code the interface

So, it goes half way to solve the problem.

That's why I've created a CodeSmith template that generates both wrapper and interface for you out of a type in an assembly. Note that this is a very raw version that would work with types located in System and System.Core assemblies (and perhaps others that are linked to the template) as I really don't have too much time right now. I might enhance it in the future.

Here is a sample configuration for creating ReaderWriterLockSlim wrapper:

<?xml version="1.0"?> <codeSmith xmlns="http://www.codesmithtools.com/schema/csp.xsd"> <propertySets> <propertySet output="WrapperGenerator.cs" template="..\CodeSmith Templates\WrapperGenerator.cst"> <property name="Postfix">Wrapper</property> <property name="InternalQualifier">private</property> <property name="IgnoreObjectMethodsAndProperties">True</property> <property name="Types"> <stringList> <string>System.Threading.ReaderWriterLockSlim</string> </stringList> </property> <property name="Namespace">Namespace.Wrappers</property> </propertySet> </propertySets> </codeSmith>

and here is autogenerated code:

namespace Namespace.Wrappers { using System; #region ReaderWriterLockSlim wrapper public interface IReaderWriterLockSlim { #region Properties bool IsReadLockHeld { get; } bool IsUpgradeableReadLockHeld { get; } bool IsWriteLockHeld { get; } System.Threading.LockRecursionPolicy RecursionPolicy { get; } int CurrentReadCount { get; } int RecursiveReadCount { get; } int RecursiveUpgradeCount { get; } int RecursiveWriteCount { get; } int WaitingReadCount { get; } int WaitingUpgradeCount { get; } int WaitingWriteCount { get; } #endregion #region Methods void EnterReadLock (); bool TryEnterReadLock (TimeSpan timeout); bool TryEnterReadLock (int millisecondsTimeout); void EnterWriteLock (); bool TryEnterWriteLock (TimeSpan timeout); bool TryEnterWriteLock (int millisecondsTimeout); void EnterUpgradeableReadLock (); bool TryEnterUpgradeableReadLock (TimeSpan timeout); bool TryEnterUpgradeableReadLock (int millisecondsTimeout); void ExitReadLock (); void ExitWriteLock (); void ExitUpgradeableReadLock (); void Dispose (); #endregion } public partial class ReaderWriterLockSlimWrapper: IReaderWriterLockSlim { private System.Threading.ReaderWriterLockSlim core; public ReaderWriterLockSlimWrapper() { this.core = new System.Threading.ReaderWriterLockSlim(); } public ReaderWriterLockSlimWrapper(System.Threading.ReaderWriterLockSlim core) { this.core = core; } #region Properties public bool IsReadLockHeld { get { return core.IsReadLockHeld; } } public bool IsUpgradeableReadLockHeld { get { return core.IsUpgradeableReadLockHeld; } } public bool IsWriteLockHeld { get { return core.IsWriteLockHeld; } } public System.Threading.LockRecursionPolicy RecursionPolicy { get { return core.RecursionPolicy; } } public int CurrentReadCount { get { return core.CurrentReadCount; } } public int RecursiveReadCount { get { return core.RecursiveReadCount; } } public int RecursiveUpgradeCount { get { return core.RecursiveUpgradeCount; } } public int RecursiveWriteCount { get { return core.RecursiveWriteCount; } } public int WaitingReadCount { get { return core.WaitingReadCount; } } public int WaitingUpgradeCount { get { return core.WaitingUpgradeCount; } } public int WaitingWriteCount { get { return core.WaitingWriteCount; } } #endregion #region Methods public void EnterReadLock() { core.EnterReadLock(); } public bool TryEnterReadLock(TimeSpan timeout) { return core.TryEnterReadLock(timeout); } public bool TryEnterReadLock(int millisecondsTimeout) { return core.TryEnterReadLock(millisecondsTimeout); } public void EnterWriteLock() { core.EnterWriteLock(); } public bool TryEnterWriteLock(TimeSpan timeout) { return core.TryEnterWriteLock(timeout); } public bool TryEnterWriteLock(int millisecondsTimeout) { return core.TryEnterWriteLock(millisecondsTimeout); } public void EnterUpgradeableReadLock() { core.EnterUpgradeableReadLock(); } public bool TryEnterUpgradeableReadLock(TimeSpan timeout) { return core.TryEnterUpgradeableReadLock(timeout); } public bool TryEnterUpgradeableReadLock(int millisecondsTimeout) { return core.TryEnterUpgradeableReadLock(millisecondsTimeout); } public void ExitReadLock() { core.ExitReadLock(); } public void ExitWriteLock() { core.ExitWriteLock(); } public void ExitUpgradeableReadLock() { core.ExitUpgradeableReadLock(); } public void Dispose() { core.Dispose(); } #endregion } #endregion }

Do you still want to code them by hand? Or do you want to use this template? Rhetoric question? What do you think?

Anyway, go get the template here.

Posted by Miha Markic | 2 Comments
Filed under: ,

Can't start World Wide Web Publishing Service because of Windows Process Activation Service

Recently I had to check out an asp.net application on my workstation and found out that the "Default Web Site" is stopped for some reason. After trying to start it I've got this message:

image

So I've tried to start the mentioned services only to get a new error message (WWW PS):

image

The mentioned dependency is the other stopped service: WAS or better Windows Process Activation Service (the original message has left out the Process word). After trying to start WAS I've got another error message:

 

image

And here the error path comes to an end. Which file? I could have used Sysinternals' FileMonitor to find out what file the service is looking for. Rather I've decided to Google first as it is faster. After experimenting with search string a bit I've found this blog entry which points to this solution. After creating the mentioned folder and applying proper security settings IIS started to work once again.

Posted by Miha Markic | 0 Comments
Filed under: ,

Intel Matrix Storage Manager (RAID) drivers are perfect!

I am using Intel's ICH9R RAID controller integrated on my server's motherboard for a RAID5 configuration of three disks. Since I don't need huge performance the mentioned hardware is enough for me - I assume the driver is bug free. Now, one would think that Intel is a serious company, their RAID controller is good and support is great, right? Wrong.

First, let me mention that this isn't my first problem with this combination, although used for RAID 0+1 with 4 disks. It corrupted the array when I was using Apple's software such as iTunes. Intel's support denied any problem with their drivers. They were perfect they said. After a while Intel silently acknowledged the problem and fixed the drivers.

Present time, my Windows 2003 R2 server went BSOD (it wasn't clear why at that time), I restarted it and immediately after login the RAID software kicked in and started rebuilding the array. It happens sometimes when OS is reset like this. After the rebuild was finished it notified me that one of the drives in array failed and array is running in degraded mode, IOW if another disk fails, say goodbye to data. I also checked the minidump produced by BSOD and go figure:

CUSTOMER_CRASH_COUNT: 1 DEFAULT_BUCKET_ID: DRIVER_FAULT_SERVER_MINIDUMP BUGCHECK_STR: 0x8086 PROCESS_NAME: Idle CURRENT_IRQL: 2 LAST_CONTROL_TRANSFER: from f7b4a79a to 80827c3e STACK_TEXT: 8089a444 f7b4a79a 00008086 8b26b1c0 8acf5340 nt!KeBugCheck+0x14 WARNING: Stack unwind information not available. Following frames may be wrong. 8089a45c f7b4adcd 0000001b 8089a500 f7b13c6f iaStor+0x3b79a 8089a468 f7b13c6f 8b266000 808722e0 8b26b1c0 iaStor+0x3bdcd 8089a500 f7b14905 8b26b1c0 8b392878 ffdffa40 iaStor+0x4c6f 8089a598 f7b511e3 8b26b1c0 00000000 8089a600 iaStor+0x5905 8089a5a8 808320f0 8b266728 8b266000 00000000 iaStor+0x421e3 8089a600 8088de1f 00000000 0000000e 00000000 nt!KiRetireDpcList+0xca 8089a604 00000000 0000000e 00000000 00000000 nt!KiIdleLoop+0x37 ##ERIGNORE##

I am not a great kernel debugging guy but it looks obvious to me that the BSOD was actually caused by iaStor which means Intel Matrix Storage Manager driver. Looks like that a drive failed and RAID driver managed to thrash my OS into BSOD instead of just mark the drive as failed (as later did). So I contacted Intel's support once again. The conversation was something like this (short version):

Me: "Your driver BSOD my OS due to a drive failure."
Intel support: "I am glad that you've found the cause of the problem, just replace the drive and array will be restored."
Me: "Yes, but what about BSOD? Your driver really shouldn't thrash my OS even if a drive fails."
IS: "These drivers have been rigorously tested and we have not experience such error. If the issue continues or reoccurs, please contact your motherboard manufacturer."
Me: "Please, it wouldn't be the first time that these "rigorously tested" drivers would fail miserably instead of protecting the disk content (providing the link to earlier problem with iTunes). Now, please, send my minidump information to a serious engineer of Intel."
IS: "Then again, we have tested the Intel(R) Matrix Storage Manager and we have not seen this. You need to keep in mind as well that we have not developed or manufactured your motherboard. Even though your board is based on our chipset and RAID controller, the integration of these vary from manufacturer to manufacturer. At this point, we can only recommend that you contact Gigabyte (op.a.: my motherboard manufactures) for further technical assistance."

Conclusion? It is groundhog day all over again. The story repeats. Intel drivers/hardware is perfect, not a chance that there is an error in there. And if you see an error, it can't be their, since they haven't seen it. Yet. They practically tested all the possibilities and their stuff won't misfire. Great job, Intel. This is support at its best - deny the problems.
Granted, there are very minimal chances that the chipset is badly integrated. And so there are chances we are not alone. If you ask me, Intel should treat a BSOD report very seriously and analyze it "rigorously". Sticking their head into the sand won't make the bug disappear. It just won't.

Posted by Miha Markic | 3 Comments

My article about missing HTC TyTN II graphics drivers published on Moj Mikro

A while ago I wrote an article about HTC TyTN II and its missing graphics drivers for Slovene computer magazine Moj Mikro. Now the article has been published on-line, so check it out if you are interested in why TyTN II's graphics performance is dismal, or how HTC is treating their loyal customers. The article is in Slovene.

Read the article here.

Update since article has been written: new ROM has been delivered with Windows Mobile 6.1 and no proper graphics drivers.

Developer Express offers free Silverlight grid: agDataGrid

That's a Silverlight 2.0 data grid of course. They won't just ship agDataGrid for free, they'll include full source code, too. Looks like WPF and Silverlight are making companies to give away their grids for free (first Xceed with their DataGrid for WPF, now this). Nice trend, isn't it.

And no, unfortunately isn't available just yet but it will be soon.

Linq to LLBLGen Pro hits the RTM!

LLBLGen Pro v2.6 is released and a free upgrade to v2.x customers. The major feature of this release is Linq to LLBLGen Pro, as Frans said, "one of the most feature-rich Linq providers available on .net today".

Having tested beta versions I can only say the this version is a step in right direction. Great work, Frans.

Posted by Miha Markic | 0 Comments
Filed under: ,

Windows Home Server just saved my day

VMWare Virtual Server 1.0.5 ... free

Microsoft Windows Home Server (running under VS)... $~170

750GB disk used for storing backups ... ~120€

Recovery from WHS backup ... priceless

I've been running Windows Home Server for quite some time now. I use it exclusively for doing nightly disk image backups for all computers of mine. WHS' storage mechanism that minimizes the disk space required for backups and its speed are just amazing. Briefly: it doesn't store duplicate data - IOW, if you have two computers with same OS, only one file per computer will be stored as long as they are exactly the same.

And like my bicycle helmet I hoped that I would never actually use it for real (to restore a computer). However, I had to restore my production machine yesterday. An odd thing happened yesterday - my Vista x86 just froze, at least so it seemed but the music from Winamp was still playing thus I deduced there are problems with graphics and the OS is still running non-graphical operations. I tried to connect using Remote Desktop without success. The remote shutdown command didn't help either. The only action remaining at that point was hardware reset switch, which should be used as a last resort. I crossed my fingers and reset the computer. Then, during the boot time (which was kind of slow) Vista started checking NTFS integrity on my disk. Ouch, not a good sign. After a while I was able to log on just to find that there is no network connection anymore and there is a problem with my event log service: "There is a problem with Event Log service. Check event log for more details" - funny, isn't it. Catch 22 by all means. At this point I was left with three options:

  1. Format the disk and reinstall
  2. Try to repair Vista
  3. Restore from most recent nightly backup

Option 1. is not that bad as it seems. Reinstalling from scratch from time to time isn't a bad idea after all - a lot of mess gets cleaned. The downside is the amount of time required - a day or two at least and constant attention.

Option 2. is more tricky. When there are such problems that I was experiencing the repair is doomed to fail.

So I opted for the most appealing option 3. After few clicks on "Next" button, 10 hours and 400GB files restored, my computer was working like it was the night when the backup was taken. The restore was straightforward and relatively quick - copying 400GB takes time regardless of how you are doing it (my restore was doing something like >11MB/s) So, big kudos to Windows Home Server - it spared me a lot of work and time.

One mystery remains though. My BIOS was downgraded (sometime before restore) somehow - it was version F10 (I upgrade it form time to time) and after computer crashed it was F3. Truth is that I am not sure when it was downgraded, this is first time I noticed it (I noticed because F3 misspelled word RAID to RIAD).

Bottom line: always have a backup handy.

Posted by Miha Markic | 0 Comments
Filed under:

SharePoint 2007 training with Sahil in Europe

Sahil "SharePoint dude" Malik will be doing advanced SharePoint 2007 training in Norway. Yep, that's the same Sahil that blogs like mad about SharePoint. So if you are into SharePoint development you are having a great opportunity to learn from the expert.

Posted by Miha Markic | 0 Comments
Filed under:

HTC did it again - new ROM, old story

At the beginning of this month news went out that HTC will release a new ROM featuring Windows Mobile 6.1 and improved graphics drivers for TyTN II device (and improvements/solutions for most of the issues). While the former was clear and confirmed by both Microsoft and HTC the later was muddy. What improved graphics drivers exactly? Then an article was published in a Dutch online site and translations suggested that HTC had actually bought proper graphics drivers from Qualcomm and it will include them in this same update. Yeah, right.

On Friday, more than two weeks later HTC actually released a new ROM for the TyTN II device (you'll find it at HTC's e-Club web site). It features Windows Mobile 6.1 but, of course - cheap, ignorant and arrogant company as HTC these days is, no proper graphics drivers at all. Yep, the first reports don't indicate any significant performance improvements, the device is still unnecessarily sluggish - even worse, new ROM has apparently brought new problems (at least to some users), among them device freezing while typing on keyboard, Internet connection sharing won't work and Skype won't work either. Furthermore many old issues are still there.

Will I install new ROM? Certainly not at this time.

Posted by Miha Markic | 1 Comments
Filed under:

SLODUG/SLOWUG server experiencing problems

As SLODUG/SLOWUG members probably already know, the server is experiencing some problems and it is down most of the time. This is old news. The good news are that the problem is being worked on and it should be fixed as soon as possible.

Posted by Miha Markic | 1 Comments
Filed under: ,

NTKonferenca 2008 Entity Framework slides

You can download the slides of my Entity Framework presentation from NTKonferenca 2008. I hope you've enjoyed the presentation.

Posted by Miha Markic | 1 Comments
Filed under: , ,

.net 3.5 SP1 beta and Visual Studio 2008 SP1 beta are here

There are various enhancements and even changes in SP1. Perhaps one of the most interesting is the change in security: applications launched from LocalIntranet will get FullTrust by default from now on (read here). I guess this is because a lot of people found annoying that they couldn't launch applications (that required FullTrust) from network shares. This move will certainly ease the internal deployment but at the same time it might cause security problems, too.

Here is the list of .net 3.5 SP1 runtime performance enhancements and another list of improvements. A list of changes in TFS. Brad Abram's list and finally Scott Guthrie's take.

Download the bits from here.

Posted by Miha Markic | 0 Comments

Developer Express steps into WPF

Developer Express, my favorite 3rd party .net component vendor, has just made its first public step into Windows Presentation Foundation world. They released a beta version of their charting product DXCharts for WPF (hey, where are those Xtra, Xpress, Express prefixes - "DX for WPF", shhh, boring ;-)). Anyway, everything is as one would expected in WPF - animations and 3D make it look good. Though it is just a first step and many features (i.e. many chart types), we are used from WinForms world, are missing at this time. But this is normal as they usually concentrate on good foundations at first and only then they add all those additional features.

Here is quick glimpse at the demo that comes with the product:

image

If you are entitled to Developer Express beta previews, go check client center for the beta bits.

Posted by Miha Markic | 0 Comments
Filed under: ,

ASPxGridView, MS Ajax and XYDataSource

If you use Developer Express ASPxGridView within MS Ajax' UpdatePanel (ASPxGridView.EnableCallBacks="False") you should be aware that you should perform DataBind() method within OnInit method (Init event). Otherwise editing just won't work, or better, it works, just the modifications aren't persisted. It took me some time to pinpoint the problem as ASPxGridView worked just fine outside UpdatePanel. I had to put it within UpdatePanel because I needed to refresh other controls as well (otherwise grid refreshes just itself).

Note that when ASPxGridView is hosted in UpdatePanel the nice error reporting feature (see the picture below) won't work either - instead you'll get script error reported by browser. IOW you have to handle errors by yourself.

image

Cool automatic error feedback

See also this support thread.

Posted by Miha Markic | 2 Comments
Filed under: , ,
More Posts Next page »