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

.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: , ,

The time of "Vote for XY product" is here again

asp.netPRO started voting process for asp.netPRO Readers' Choice Awards 2008 as they do every year. And all of the 3rd party component vendors are asking for your vote, as usual. Nothing wrong there. But there are two things that I noticed during my voting. First, immediately on the top of first page, I saw this product:

image

This refactor tool was around at the time of Visual Studio 2002/2003 and died soon after, or better it froze. The web site is still there and you can even download it for free (Order tab). It was a great product at that time, offering refactoring when nobody else did. However the product is dead as the dodo for many years now. So I wonder, why is such product even listed as a choice?

The other odd thing is the categories. For example, Component Set category lists a lot of different sets. I mean different like apples and hard disks. How can one compare those? Or Utility category where the difference is even huger - looks like basically everything that didn't fit in other categories landed here. Go ahead and compare Aqtime profiler with dtSearch with LLBLGen Pro. Which is better? I think the products with larger client base will get more votes simply because it is natural that you would vote for product you own in such case.

What gives? The results in at least the two categories mentioned can't be relevant if you ask me, or better, they'll just reflect the client base size of each product.

Posted by Miha Markic | 0 Comments
Filed under: ,

LLBLGen Pro gets LINQ capability

My favorite ORM tool just got better - Frans implemented Linq to LLBLGen Pro. He really implemented it to the last detail as he writes in a series of blog post (a must read for everybody doing LINQ to an ORM product).

If you are a customer go grab the beta bits. If you are not, well, it is a reason more to become one.

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

Building your own Media Center

Since I have IPTV I am really annoyed by not having an option to save programs, like in old video recorder and cable network days. True, one can still save using video recorder, but the problem is that video recorder can't change channels on STB (set top box) and thus you are limited to a single channel. Pretty much useless. The other option is using personal recorder, a feature provided by my IPTV provider. But again, the drawbacks are enormous: there is a monthly fee, you are limited to 6 hrs of total saved content. Even worse limitation is that your content can be stored for maximum of two days (forget vacation, or drive back to home every two days to watch the saved content). But there's another drawback, in fact mother of all drawbacks: only a few channels and not all shows on those channels are allowed to be saved. Total useless crap.

Hence the idea of my own media center. After all I live by using my development skills, why not use them for this one. So, RH Media Center project was born.

The main objectives:

  1. ability to save from IPTV
  2. ability to schedule saving
  3. ability to playback saved content
  4. ability to control RH Media Center by remote

Hardware requirements

  1. A computer (server which is always on preferably) that will be used to save content
  2. A computer to playback the saved content (possibly attached to TV). In my case this is my laptop.
  3. A PocketPC device (remote control)

1. and 2. can be the same computer, whatever is feasible for you.

Implementation

VLC media player ActiveX control is at the core of RH Media Center. VLC media player is a free, open source, cross platform application that plays just everything out there, including SIOL IPTV streams. And luckily for me, they have an ActiveX control, too. In fact I've build my application around this ActiveX control using Windows Forms UI. Here is how it looks:

 image

Video (both IPTV stream and saved content playback) is rendered and saved by VLC. You can also see a bunch of controls on the top and the channel listing on the right. There is also saved content listing in the docking panel next to channel listing.

image

Test saved contents listing

Note that UI is pretty rough at this time as prettiness wasn't one of the objectives. Anyway the objectives 1. and 3. are done now.

Scheduling

Once the core functionality is done (see above) the scheduling is pretty easy. The application should parse command line arguments and start saving given channel for given time. The content file name should be made of given argument (i.e. name of the show) plus date. Here is an example:

RhMediaCenter.exe rec "Channel" ShowName 120

This means that content from "Channel" will be recorded for 120 minutes to a file name

ShowName_hh_mm__dd_MM_YYYY.ps

ps is MPEG-PS extension. You'll note that I didn't specify when should the recording start aka scheduling. This step is done using Task Scheduler - no wonders there, just run that command line at any time you specify and that's it. A bit rough to configure but it works just fine (in future I'll enhance the configuration step).

Remote control

Every decent media center has remote control capabilities. How can you skip those commercials otherwise? I've figured out, that I have a bunch of PocketPCs lying around and collecting dust. At the same time I have a Wi-Fi network at home. Get the idea? Yes, I'll use PocketPC over Wi-Fi to control my media center. The technology of choice is WCF which is partially supported with .NET Compact Framework 3.5. BasicHttpBinding, here we go.

So I've build a simple Windows Mobile 6 application which looks like this:

image

It allows to connect to preferred RH Media Center through providing a proper IP, it can get a list of saved content and it allows you to play any of them. It features also a Pause button and move forward (left group of buttons) or backward (right group of buttons) for a given time span. And after creating a hole in Windows Firewall on computer where RH Media Control runs it just works.

The only problem is how to build WCF service client code for .net compact framework. This feature is provided by Power Toys for .NET Compact Framework 3.5's NetCFSvcUtil utility that does the similar job as Service Metadata Utility (SvcUtil.exe) for .net framework.

Conclusion

I solved the biggest IPTV issue - saving programs and playback of saved content using a remote control. By using .net 3.5/Windows Forms/WCF/Compact framework and VLC ActiveX control it took me only around 10 hours of total time over the weekend (most of the time I used for plumbing , user interface and figuring out VLC ActiveX oddities). If you wonder why I'd used Windows Forms instead of WPF: because I was experimenting at the beginning (and the project is still an experiment) and I have no 3rd party controls for WPF yet - so it was easier with Windows Forms. In future I'll be definitely using WPF.

I have to say that .net/VLC made it so easy to build this pet project - the ease of putting pieces together is amazing.

BTW, Is anybody interested in binaries? (I am not saying I'll provide them nor that I won't provide them :-))

"The target assembly contains no service types. You may need to adjust the Code Access Security policy of this assembly." annoyance

Did you ever encounter this dialog box when dealing with WCF services?

"The target assembly contains no service types.  You may need to adjust the Code Access Security policy of this assembly."

It might happen when you run application at debug time. It is highly annoying and time consuming (it pauses application for more than one minute without any apparent reason). But what does it mean and why does it happen?

When you create a project from a WCF project templates Visual Studio knows that this project is a WCF service and thus it offers two debug time helpers: WCF Service Host and WCF Client. These two guys are intended to help you with running and testing WCF services without writing any code - they just appear at debug time. So far so good. But why the annoying dialog?

The dialog in question means that you have a project, created using one of the WCF project templates, with an interface marked with ServiceContract attribute and in the same project you don't have a class that implements this interface (perhaps you implemented that interface in another project). So, the WCF Service Host can't find a suitable class to host the service and it complains through that dreaded dialog box. Note that WCF Service Host is pretty dumb and it is incapable of searching through other projects in same solution. OK, the solution is to stop running WCF Service Host or even better, instruct it which class implements the interface in question. Well, AFAIK the later is impossible while the former can be done through project file modification using notepad. Here is how:

Delete this line from your project file:

<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

And you won't see WCF Service Host or dreaded dialog anymore.

The question is, why didn't Microsoft think of these scenarios before?

BTW, if you just want to stop WCF Client from runing then delete this command line argument: /client:"WcfTestClient.exe", created by WCF project template.

Posted by Miha Markic | 3 Comments
Filed under: ,

LINQ to XtraGrid

If you work with Developer Express XtraGrid's GridView then you know that it provides a relatively cumbersome way to read values of its grid cells: the values aren't strong typed and the method is somehow not very OO oriented. It goes like this:

// read an int value from a cell int value = (int)gridView.GetRowCellValue(rowHandle, colAnIntColumn);

Note that you can't read the value like this:

int value = (int)gridView.Rows[rowHandle].Value(colAnIntValue); // or int value = gridView.Rows[rowHandle].ColAnIntValue;

which would be more object oriented but probably the performance would suffer. If Value property would be strong typed it would be just great. But the most important feature would be to access the values through Rows collection. Why? Because one could use LINQ to query them. That is unfortunately impossible out of the box.

Here is a simplified sample code to find the rowHandle of the row with SOMEVALUE in one of its colAnIntColumn field:

int rowHandle; for (int f; f<gridView.RowCount; f++) { int value = (int)gridView.GetRowCellValue(rowHandle, intCol); if (value == SOMEVALUE) { rowHandle = f; break; } }

It isn't really pretty, right. Hence the idea of using home made LINQ to XtraGrid.

First, we need a class that will represent a single GridView's row:

public class GridViewRow { internal readonly GridView GridView; internal readonly int RowHandle; public GridViewRow(GridView gridView, int rowHandle) { GridView = gridView; RowHandle = rowHandle; } // method that wraps GetRowCellValue method for getting a cell value // using column name public T Field<T>(string fieldName) { return (T)GridView.GetRowCellValue(RowHandle, fieldName); } // overloaded method that wraps GetRowCellValue method for getting a cell value // using column reference public T Field<T>(GridColumn column) { return (T)GridView.GetRowCellValue(RowHandle, column); } }

The code is pretty trivial. The class has to reference the source GridView and RowHandle that represents a row in GridView's notion. Note the two Field<T> overloaded methods that lets you get cell values in OO manner. Next, we need a collection of GridViewRow objects that implements IEnumerable<T> (IEnumerable<GridViewRow> in this case) interface (which in turn implements IEnumerable hence the two GetEnumerator() methods):

public class EnumerableGridViewRowCollection: IEnumerable<GridViewRow> { internal readonly GridView GridView; public EnumerableGridViewRowCollection(GridView gridView) { this.GridView = gridView; } public IEnumerator<GridViewRow> GetEnumerator() { for (int i = 0; i < GridView.RowCount; i++) yield return new GridViewRow(GridView, i); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } }

The core functionality here is public IEnumerator<GridViewRow> GetEnumerator() method. It uses yield return keyword to create GridViewRow instances for each row as query progresses through collection. From the perspective of garbage collection this shouldn't be too huge problem because the objects are small and have a short lifetime usually. Thus they are relatively cheaply garbage collected. Furthermore one doesn't work with million or rows in a grid - if you do, reconsider your approach; but rather in range of thousands. This class also holds reference to source GridView.

Now we have a GridViewRow class that represents a GridView's row and a collection of row objects that are dynamically generated for each query. The only step left is to build a way to get the EnumerableGridViewRowCollection out of GridView. We could use a helper class, pass GridView to EnumerableGridViewRowCollection directly, or derive a class out of GridView and add such a method. However the former aren't really nice and the later is complex and doesn't provide same functionality for other GridView derived views. Fortunately for us .net 3.5 introduced extension methods which are a perfect way to implement this functionality. Here is how I've built it:

public static class GridViewEnumerator { public static IEnumerable<GridViewRow> AsRowEnumerable(this GridView gridView) { return new EnumerableGridViewRowCollection(gridView); } }

This dude adds method AddRowEnumerable to GridView class and to all of derived classes.

LINQ to XtraGrid is now complete and here is rewritten sample query from above:

int rowHandle = gridView.AsRowEnumerable().First( row => row.Field<int>(intCol) == SOMEVALUE);

Doesn't it look nicer and more compact than the query above? The beauty of the LINQ to XtraGrid is that it opens a whole LINQ world to XtraGrid's GridView and descendants. Yes, you can use whatever LINQ construct that works on IEnumerable<T> such as:

var query = from row in this.AsRowEnumerable() where row.Field<int>(intCol) == SOMEVALUE group row by row.Field<string>(nameCol) into g orderby g.Key select g;

So, here it is. A simple LINQ to XtraGrid implementation. It doesn't do everything, but hey, it is a start. Happy?

Posted by Miha Markic | 2 Comments

My first article published in Moj Mikro, Slovene computer monthly magazine

The article is all about HTC's dirty secrets behind its line of PocketPC's based on Qualcomm's MSM7x00 CPU/chipset and is my first article being published in such a large scale magazine or in any magazine I guess. Moj Mikro also brings my memories back; I remember when I was young and I was eagerly waiting for the magazine each month. At the time Moj Mikro was more or less the only Slovene computer magazine and one of the few Yugoslav ones (Slovenia was part of Yugoslavia then and there were a couple of Serb computer magazines, too).

Anyway, the magazine comes out on the first Tuesday in March and I hope you'll enjoy my article titled "Umazane podrobnosti HTC mobilnih naprav – dejstva, ki jih je HTC zamolčal".

Feedback appreciated of course.

Is true belief a good attribute of an architect

Recently I've came across this forum thread regarding the future of Developer Express' eXpress Persistent Objects for .NET (XPO) ORM product. Customers (actual ones, not potential) are asking whether XPO will someday support n-tier development. They are happily using XPO but they miss a vital part, which is n-tier development. Note that XPO never advertised n-tier support and nobody is arguing that. Perhaps this comment from a customer's post, where the situation is described:

"As Trevor said, I am one whose core is 100% XPO. The future of my application is tied to XPO. Was this a bad decision? Maybe, but probably not. However, XPO lacks in areas (n-tier) where I really need it to start to shine."

Later on Oliver from Developer Express comments that Developer Express is planning to add, among various features, a multi-tier support. No other details, no dates, no nothing:

"The architectural changes we are planning will result in the potential to support a variety of layered application architectures, including multi-tier ones. So this is good news for you and everybody else waiting for this kind of functionality."

And crowd goes cheering and applauding. Can this be defined as a true belief? From the point of Developer Express such a comment in current situation makes sense (I won't question whether XPO is good or bad and if it is going n-tier or not at this point). What I fail to understand is the crowd. How can it be that you use a product that misses a very important feature for you (from the beginning!) and you are prepared to wait for years to get it? We aren't talking about a cosmetic feature. No, we are talking about core functionality. And you are happy that somebody is planning someday to deliver that feature, which might suite you or not, without any obligation to deliver (again, I am not questioning Developer Express).

Generally speaking, is such a belief and faith that the feature will be what you've asked for, a good attribute of an architect? Would you choose a product that doesn't support a core functionality and it might never support it. Knowing that competition is stiff and you have plenty of choices out there that support this feature and more, you are a bad architect if you don't look around. At least one I wouldn't trust. This is simply bad practice. If you are basing a core part of your application on something, it should work from the start. Gambling on future is not an option.

Posted by Miha Markic | 1 Comments
Filed under: ,

Visual Studio 2008 web-design related hotfix

Microsoft relased Visual Studio 2008 hotfix that should eliminate some web-design annoyances, particularly the slowness of the IDE, according to the specs.

Get the hotfix here. I hope that we'll see more hotfixes like this in the future as service packs really take just too much time.

Posted by Miha Markic | 1 Comments
Filed under: ,

Today is the deadline for applying to Silverlight challenge

Don't forget, Silverlight challenge is going to close after today. So, apply before it is too late. MIX and other great prizes are still waiting for you!

Posted by Miha Markic | 0 Comments
Filed under: ,

telerik supporting Mono?

Looks like telerik is going to support Mono. This news is certainly interesting for Mono guys as it might give wings to Mono. Which is a good thing, indeed. However, the support (if it is going to happen) will probably be limited to asp.net components - they don't even mention WinForms at this point. I assume that running WinForms controls on Mono is a different story because WinForms controls are still pretty much tied to Windows API for performance reasons. I wonder if the situation will change with adoption of WPF where there is no need to hook into Windows API directly.

UPDATE: This news is not new news but old news (2 years).

Posted by Miha Markic | 2 Comments
Filed under: ,

HTC is giving a finger to its customers

I already reported about presumably lack of drivers in newer HTC devices. At the time it was all speculation. Now we have an official response from HTC. They are basically saying:

Yes, we advertise the devices as great, the devices have actually great hardware but we don't include proper drivers because it would take time and effort from us. Thus the devices perform worse than years older devices but it is still good for you. We won't provide drivers for actual devices, no, that would take time and effort from us. Instead, since you demand it, we will sell you future devices with such drivers, if you really want it. Maybe.

Now, let's play a couple of analogies. Let's say you bought 64 of the newest top notch graphic card, that features a zillion of pipelines and 64 way SLI. You plug them into your mobo that supports 64 SLI graphic cards and try playing Duke Nuke'm 4 only to find out that graphics perform same as with a single 4 year old graphic card. The reason being drives not included. Nor they are available at all. What? You did assume drivers were there?

Let's see a car analogy. You buy a great car, that includes a turbo charger. Yet, the acceleration and top speed are low. The reason being turbo charger is not working because is not connected. And you can't connect it since nobody is selling connection cables. What? You did assume turbo charger will work?

Now, let me state this clear, as there is some misunderstanding in the air. It is not just about video playback speed and quality. The entire UI is slow. Try running Windows in safe mode with VGA mode enabled and you'll get the point. This lousy UI performance casts a very dark shadow to Microsoft Windows Mobile, too - many says that the slowness is because Windows Mobile sucks. Perhaps, but the core reason is the lack of hardware acceleration. No wonder that iPhone had such a success. In this case Apple did an integral product, not just created good hardware and throw it to the customers. No, they actually provide proper software, too. (I am still in favor of Windows Mobile devices though for other reasons, such as programmability). Looks like the Windows Mobile device manufacturers lack of common sense when comes to usability.

So, what does the biggest Windows Mobile device manufacturer do when its customers point out that it is selling an underperfoming device just because lack of proper drivers. Will they rectify the problem and provide proper drivers? Will they provide proper drivers for a small fee? No, HTC shows a proverbial finger at its loyal customers (HTC is also mentioning how much they value their customers in every press release). I only hope that this attitude will backfire on them.

The biggest mystery of this story is, why isn't HTC including these drivers by default. I mean what company wouldn't like to have best performing devices out there? I presume that there are two basic reasons:

  1. They are plain stupid (they don't see why those would be required, even now, with iPhone UI performance out there)
  2. They are cheap. Which is stupid again. Because they won't spend money on better software they'll loose additional customers. But if they did spend it would be certainly an overall profit for them.

I really can't think of other reasons.

So, it is not just about the lack of drivers, what really is sad, is the response and attitude from HTC.

But hey, let's give the finger back - I won't buy a HTC device again and I am sure that many others won't as well.

Posted by Miha Markic | 5 Comments
Filed under: ,

VS2008 SP1?

I just read an interesting post about debugging enhancement for Visual Studio 2008 SP1. Right, the post isn't interesting just because of new features but also because it actually mentions the existence of SP1. Looks like we might see SP1 earlier then expected :-)

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