Getting HRESULT: 0x80131515 when running Righthand DataSet Visualizer?

by Miha Markič 30. May 2010 11:57

Are you getting a HRESULT: 0×80131515 when invoking Righthand DataSet Visualizer from Visual Studio like this:

image_thumb11[4]

The problem is that OS marked the visualizer assembly as unsecure since it originated from the Internet. The solution to the problem is an easy one.

Locate the Righthand.DebuggerVisualizer.Dataset.2010.dll within File Explorer, right click to get Properties and click on Unblock button:

HRESULT: 0x80131515 error dialog

Happy DataSet/DataTable visualization!



Tags:

.net | .net 4.0 | Visual Studio | Visualizer

What’s new in C# 4.0 presentation at NTK 2010 in Portorož

by Miha Markič 25. May 2010 14:11

Tomorrow I am talking about new features in C# 4.0 at NT Konferenca in Portorož, Slovenia and I’ll be there through all day. So if you want to hear what features were added to C# in its latest incarnation you are welcome to attend the presentation taking place in Emerald 1, 14:45 – 16:00.

Later I’ll participate in MVP Panel in MSTech (Pečina), 16:30 – 17:30 and as a SLODUG lead I’ll be present at SloUG meeting in Sunset, 17:30 as well.

If you just want to talk about something .net-ish or just want to say hi, feel free to find me as I’ll be lurking around during my free time.

BTW, the official NT Konferenca twitter tag is #ntk10.



Tags:

Announcement | .net 4.0 | Presentation | SloDUG | Slovenia | VS 2010

Visual Studio 2010 and .net 4.0 are being released today

by Miha Markič 12. April 2010 13:36

Today is the day. See Soma’s announcement and prepare your browsers pointed to MSDN Subscriber Downloads. The goods should be available for download starting at 10AM PST which translates to 19:00 for Slovenia (you might check out other local times).

Also watch the Visual Studio 2010 launch event live here.

Some useful links:



Tags:

.net 4.0 | VS 2010

My first WPF 4.0/Windows 7 multitouch application

by Miha Markič 19. March 2010 22:58

So I finally bought an Acer T230H multitouch enabled monitor that is supported by Windows 7. Actually, it is a dual touch but that’s enough. (for more on multitouch input devices for Windows 7 see my previous article).

On the good side it is a decent 1900×1080 monitor, not too expensive and multitouch works even under VMWare Workstation 7. On the bad side I knew it has some problems following fingers. Actually sometimes it gets just confused. That’s not a problem for a project I am working on but nevertheless I was curious.

Hence I created my first multitouch application that visualizes touch positions from monitor. Here is a screenshot featuring two fingers:

image

The application itself supports two different colors because I was interested only in two (no problem adding more if somebody wants me to). So, try the application and see how good or bad does your multitouch input device. Note, .net framework 4.0 RC is required.

As per my Acer T230H: indeed it has problems that usually manifest when fingers are nearby. And sometimes it just gets confused. Heck, it is one of the first multitouch monitors and a cheap one.

Have fun multitouching!



Tags:

.net 4.0 | VMWare | Windows 7

Enabling and understanding code contracts in Visual Studio 2010 beta 2

by Miha Markič 7. January 2010 12:05

Code Contracts are a new way to do both runtime and static checking of your code coming with .net 4.0/Visual Studio 2010.

Prerequisites

Visual Studio 2010 beta 2. To enable Code Contract project tab you need to update code contracts by downloading the latest version from Code Contracts web page. You’ll find very good introduction documentations on the same side from Documentation link (PDF).

Here is a really simple example of a code that uses Code Contracts

static void Main(string[] args)
{
    decimal c = Divide(4, 0); // fails validation because b == 0
    List<int> list = null;
    Add(list, 5); // fails validation list == 0
}

static decimal Divide(decimal a, decimal b)
{
    Contract.Requires(b != 0);
    return a / b;
}

static void Add(IList<int> list, int element)
{
    Contract.Requires(list != null);
    Contract.Ensures(list.Count == Contract.OldValue(list.Count) + 1);
    list.Add(element);
}

Pay attention to Contract static class and its Requires (pre-condition) and Ensures (post-condition) methods. There is lot more to these two methods i.e. you can even access original argument values through OldValue method – make sure you read the documentation.

Just the code by itself won’t do much. To enable both runtime and static checking you have to open project properties and check Perform Runtime Contract Checking and Perform Static Contract Checking checkboxes. If the static analysis has been checked then you’ll see warnings in the Error List (and Output) window regarding contracts failures. If you enable runtime checking you’ll get assertions (by default, but you can easily switch to exceptions) when the program execution hits contract checking failure.

The interesting aspect of Code Contracts is how it implements post conditions – it injects the proper code at the place of the post condition methods. Something like Post Sharp has been doing for years. Looks like AOP is slowly getting into the .net after all.

Try it for yourself.



Tags: , ,

VS 2010 | .net 4.0

Want to try Parallel Extensions on .net 3.5?

by Miha Markič 20. November 2009 10:06

Check out Reactive Extensions to .NET (Rx). Looks like it includes “a back ported (and unsupported) release of Parallel Extensions for the .NET Framework 3.5 in the form of System.Threading.dll”. So, if you don’t have Visual Studio 2010 beta handy you might check it out and let us know how it goes. While you are there make sure you check out Rx as well as it looks an interesting and useful library once you grasp its concepts.

See the related blog post.



Tags:

.net 3.5 | .net 4.0 | Parallel programming

What’s new in the BCL in .net 4.0 beta 2

by Miha Markič 22. October 2009 09:47

Check out this post about what’s new in the BCL in .net 4.0. beta 2. As you can see there is a good amount of timesaving functionality.

My favorites are Stream.CopyTo, String.Concat/Join overloads that take IEnumerable (no more casting IList to Array!) and of course Enum.HasFlag which I already implemented it my way.

I wonder though why they created Environment.Is64BitProcess and Is64BitOperatingSystem. At the present time it makes sense but Microsoft is already talking about 128 bit Windows OS. We’ll get, I suppose, a couple of years after a 128 bit Windows is released new properties: Environment.Is128BitProcess and Is128BitOperatingSystem and years after that perhaps 256 bit versions of them.

So, wouldn’t it be easier to have an enum like:

enum Bitness
{
    16Bit,
    32Bit,
    64Bit
}

And when 128 bit version comes out a new value of 128Bit might be added. So we might have Environment.ProcessBits and Environment.OSBits or something that would return Bitness enum, would be future proof and easier to use than inspecting all IsXXXBitXXX methods.

Or perhaps, if adding a new value to an enum poses some kind of problem, just return an int instead of an enum representing the number of bits.



Tags:

.net | .net 4.0

Visual Studio 2010 beta 2 and .net 4.0 beta 2 available on MSDN

by Miha Markič 20. October 2009 10:14

Both Visual Studio 2010 beta 2 and .net 4.0 beta 2 are available for MSDN subscribers and on Wednesday for everybody. Perhaps an important feature is that a “go live” license is available.

Release has been announced for March 22th next year. I guess RTM will be available before the year’s end for MSDN subscribers – judging from the Visual Studio 2008 timeline.

Here is a bounch of useful beta 2 launch blog posts:

About TFS 2010

Hanselman’s post

Jason Zander’s post

What’s new for the Task Parallel Libary

ScottGu’s post

and of course Somma’s post

Just don’t forget that this is beta 2 release and you should be cautious – installing it in a virtual machine rather then production one is always a good practice when dealing with early builds.



Tags:

VS 2010 | .net 4.0 | .net | Visual Studio

Dealing with iterations over null lists in LINQ to Objects

by Miha Markič 15. October 2009 10:41

Problem

If you used LINQ to Objects you have certainly come across iterations over null values resulting in an ArgumentNullException being thrown at you.

See this example:

int[] b = null;
var query = from i in b select i;

In the case above the error is obvious but if the list comes as an argument of a method or some more complicated way it is hard to spot it. Sure, the obvious solution is an easy one. A simple if statement before will do it:

if (b != null)
    var query = from i in b select i;

What about nested loops? Like this

class Tubo
{
public List<string> Strings;
}
...
IList<Tubo> tubos = ...;
var query = from t in tubos
from s in t.Strings
select s;

Sure, we could add guardian clauses like the if before:

if (tubos != null)
     var query = from t in tubos
        where t.Strings != null
        from s in t.Strings
        select s;

The problem with this approach is that it gets cluttered and it complicates the flow, specially the first if.

Solution

So, here is my proposal and I am sure it has been proposed before (I just couldn’t find it on Google, err, I mean internet).

public static class Extension
{
public static IList<T> Safe<T>(this IList<T> source)
{
if (source == null)
return new T[0];
else return source;
}
}

The extension method makes sure that query always gets a non-null list by making an empty one if it is null. The trick with extension method is that they can be invoked on null values which are passed as this argument.

And the last nested LINQ to Objects loop would look like:

var query = from t in tubos.Safe()
             from s in t.Strings.Safe()
             select s;

I am not sure that the extension method name Safe is adequate or not but it sure does help in code readability.

What do you say?



Tags:

.net | .net 3.5 | .net 4.0 | LINQ

My favorite features in upcomming Visual Studio 2010/.net 4.0

by Miha Markič 1. June 2009 21:48

The following two are my favorite features comming with .net 4.0 and Visual Studio 2010:

  • parallel extensions - a great and easy way to utilize those idle cores in your multi core machines. It might be as easy as adding an AsParallel() extension method to a LINQ query. I even did a bunch of presentations on the topic, the last one at NT Konferenca 2009.
  • code contracts - improving the code in both design time (static analysis!) and runtime (note: albeit this feature is a part of .net 4.0 beta you have to download the package to install design time support for Visual Studio 2010 beta. This step is supposed to be redundant for RTM or sooner).
Perhaps there are other better features however these two are the ones I am most interested *currently*. So, what are yours?


Tags:

.net 4.0 | VS 2010

Miha Markič

About me
Righthand
 
Microsoft MVP
 
Developer Express' DXSquad
INETA Country Leader for Slovenia
INETA Country Leader for Slovenia

Slovene Developer Users Group Lead
Friends of Red-Gate
LLBLGenPro Partner

Miha currently works as a free lance consultant and software developer specialized in .net area.
He graduated in Computer and information science at the University of Ljubljana, Slovenia. He has accumulated experience in various programming languages such as Java, Visual Basic 3-6 (MCP), Visual C++, Delphi, C# and VB.Net through years.
He has experience in practically all (technical) stages of project development, including planning, framework development, user interface, business processes, as well as testing and documenting. He has worked on big and small projects in Slovenia and abroad (e.g. participated in completing level 3 IS for the Nucor steel plant, Hertford, USA).
Currently he enjoys programming in .net environment using C#. Since 2000 he has been active in Developer Express' DX Squad and has been ECDL trainer and tester. He also gives lectures on conferences and other events in Slovenia.

Shortcuts

Add to Technorati Favorites

Social networking

Most comments

Electrolux Ergorapido Electrolux Ergorapido
1 comments
pr Puerto Rico
Holiday Travel Deals Holiday Travel Deals
1 comments
us United States
Marko Marko
1 comments
si Slovenia
olivier olivier
1 comments
fr France

Google friends

Recent Comments

Comment RSS