WinRT Data Virtualization implementation in C# - c#

I have asked this question on the MSDN forum (with no success), maybe StackOverflow will prove its strength one more time...
I was attending Hamid Mahmood's session on collection and list apps and was excited to see control-level support for data virtualization. Unfortunately, no details were given on how to implement IVirtualizingVector and IIncrementalLoadingVector, and it is not evident how to do so by looking at the interfaces themselves.
Can anybody post a sample?
Additional bonus question for SO - is there an easier way to implement IAsyncOperation (needed by IIncrementalLoadingVector implementation) than coding it "from scratch"?

For your bonus question, have a look at the overloaded Create method available in System.Runtime.InteropServices.WindowsRuntime.AsyncInfoFactory, specifically the overloads that take Func<Task<T>>.

I have posted an article on my blog showing how to implement IVirtualizingVector here. It describes an overview of how IVirtualizingVector works, as well as an implementation that you can use released as part of the open-source Cocoon framework. I hope to also show how to use IIncrementalLoadingVector in the future.

Related

What ORB algorithm implementations are available?

We want implement ORB algorithm on C# language. Yes, we can use OpenCV with wrapping, but it's very heavy for our purposes.
I make some research in web and found only this https://github.com/opencv/opencv/blob/master/modules/features2d/src/orb.cpp and try to reimplement ORB source.
But now it's works with multiple bugs and very slow, I think we make some mistakes.
OpenCV have a lot of macros and links to other functions from OCV Core. And C++ it's very hard for sugar-language programmers like C#.
Would you get some links on other ORB implementations (may be on other languages), or good theoretical link, where we can check our C# ORB implementation step by step?
Some other implementations I found:
skimage.feature.ORB (Python) with source code in master here
Arrayfire ORB
There is a good post about explanation of ORB descriptor: A tutorial on binary descriptors – part 3 – The ORB descriptor. If you want to know detailed information leave a comment to this post.
Also try to read the original paper ORB: an efficient alternative to SIFT or SURF.
You may contact to the authors about source code via emails directly.

How does one implement a custom sync provider?

Yes I have read this but its very unclear, especially when you want to write a provider for Outlook so, maybe you know of a normal tutorial on how to do this, or similar?
I'm guessing, after staring for 4-5hours at MSDN code I could achieve enlightenment...
I just found an old article on MSDN about the whole topic. It's not that helpful and does not provide full samples. But the author actually wrote a book about that topic. They even provide lengthy examples which are available as public download. You can find the implementation of a custom sync provider inside the archive at "\Pro Sync Framework\Chapter III\Code\CustomProvider\CustomProvider.sln".

Is MSDN website sufficient for C# self-learning?

I know there are plenty of books on C#, but I'd rather learn by reading articles/guides and watching video tutorials. Would Microsoft's MSDN website be enough to teach myself C# in depth?
Thank you.
**Update*:*
#Jon Skeet: Thanks for your honest answer. I might just do that then, - I'll get Table of Contents from a C# .NET book and then go through each topic on MSDN.
Thanks again to all of you. I wish I could mark everyone's answer.
All the information is there, yes. Heck, the C# specification is available there, so that's all you need, in theory.
However - and I'm biased as the author of a C# book, of course - I believe that books add value by giving you a structured learning experience. Authors put a lot of time into working out the order in which to introduce concepts so that it makes the most sense.
Of course you could just take the table of contents from a C# book and then look up bits of MSDN in that order - but a good book will lead you through in a more orderly manner, building on examples and areas you've learned before rather than treating each one individually.
IMHO this will depend on your general programming level. If this is your first encounter with programming I think that a book would be better than MSDN. If on the other hand you have experience with similar technologies such as Java there's no reason MSDN wouldn't be enough as it contains extensive documentation, many tutorials and samples.
MSDN comprehensively covers all aspects of C# and the .Net platform. so Yes MSDN is sufficient to learn C#.
I would say so too, but only as a reference. That's what I did, and still do.
Edit: It might be hard for a beginner, but not impossible.
I think MSDN is a very good place to teach yourself C# in depth, that being said I don't think it's a good source to get you started.
Let me explain... MSDN is a great place when you want to work out how things work and why, what other options are there and all the rest of little details other sources usually overlook, but can be important. However, I think it lacks a certain "get up and do something meaningful" attitude you are looking for when learning a new language.
Just my 2 cents worth though.
Though I personally didn't learn it that way, there are some excellent resources on the MSDN now vs when I started with .NET.
In general, if you're going to learn C# from the MSDN, your launchpad will be here. If you're new to programming in general, here looks like a good place to start.
As far as I see it, there are articles about how to do things and articles about classes/methods, etc.
Some of the examples in articles about a class or method aren't enough for you to say that you know them and don't discuss everything, so I'd say they're a starting point - together with blogs and articles and tutorials on other sites you will probably get a lot more information.
The articles about how to do things, that start with a problem and show how to solve it, are ok and clear (or at least the ones I've read).
It also depends on what you already know and what you're building on.

NCommon - resources, documentation

I like NCommon project, but the lack of resources and documentation makes it very hard to use.
Does anyone of you know some good resources, examples...?
I figured out some basic setting, like Repository Pattern etc. But i'm completly lost i.e. with "NCommon.Rules".
Thank you.
NCommon author Ritesh Rao has sadly been very quiet for the past year. His blog is nevertheless an excellent resource for discussion of the rationale behinde (some of) the ideas in NCommon.
I agree that it's currently difficult to understand what all the clever stuff in the framework is really for since there's no sample app included in the source.
Ritesh did say a while back that he intended Rhinestone to be a sample for NCommon but that never came to fruition. However, if you look here you'll see that Ritesh is about to make a renewed effort to do a sample app and has started work on NCommon 1.1 (now on GitHub)
One final note of caution is that Ritesh has not tagged all of the pertinent posts in his blog with the NCommon tag because he started disussing some of the patterns he's used before he thought of rolling it all into NCommon so check his older posts also. For example he talks about implementing a Persistence Ignorant Unit of Work but didn't tag it with NCommon.

Are there any suggestions for developing a C# coding standards / best practices document? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm a recent AI graduate (circa 2 years) working for a modest operation. It has fallen to me (primarily as I'm the first 'adopter' in the department) to create a basic (read useful?) C# coding standards document.
I think I should explain that I'm probably the most junior software engineer going, but I'm looking forward to this task as hopefully I might actually be able to produce something half usable. I've done a pretty extensive search of the Internet and read articles on what a coding standards document should / should not contain. This seems like a good as place as any to ask for some suggestions.
I realise that I am potentially opening a door to a whole world of disagreement about 'the best way to do things'. I both understand and respect the undeniable fact that each programmer has a preferred method of solving each individual task, as a result I'm not looking to write anything so draconianly proscriptive as to stifle personal flair but to try and get a general methodology and agreed standards (e.g. naming conventions) to help make individuals code more readable.
So here goes .... any suggestions? Any at all?
We start with
Microsoft's .NET guidelines: http://msdn.microsoft.com/en-us/library/ms229042.aspx (link updated for .NET 4.5)
Microsoft's C# guidelines: http://blogs.msdn.com/brada/articles/361363.aspx.
and then document the differences from and additions to that baseline.
IDesign has a C# coding standards document that is commonly used. Also see the Framework Design Guidelines 2nd Ed.
Ironically setting the actual standards are likely to be the easy part.
My first suggestion would be to elicit suggestions from the other engineers about what they feel should be covered, and what guidelines they feel are important. Enforcing any kind of guidelines requires a degree of buy-in from people. If you suddenly drop a document on them that specifies how to write code you'll encounter resistance, whether you're the most junior or senior guy.
After you have a set of proposals then send them out to the team for feedback and review. Again, get people to all buy into them.
There may already be informal coding practices that are adopted (e.g prefixing member variables, camelcase function names). If this exists, and most code conforms to it, then it will pay to formalize its use. Adopting a contrary standard is going to cause more grief than it's worth, even if it's something generally recommended.
It's also worth considering refactoring existing code to meet the new coding-standards. This can seem like a waste of time, but having code that does not meet the standards can be counter-productive as you will have a mish-mash of different styles. It also leaves people in a dilemma whether code in a certain module should conform to the new standard or follow the existing code style.
I have always used Juval Lowy's pdf as a reference when doing coding standards / best practices internally. It follows very close to FxCop/Source Analysis, which is another invaluable tool to make sure that the standard is being followed. Between these tools and references, you should be able to come up with a nice standard that all your developers won't mind following and be able to enforce them.
The other posters have pointed you at the baseline, all I would add is make your document short, sweet, and to the point, employing a heavy dose of Strunk and White to distinguish the "must haves" from the "it would be nice ifs".
The problem with coding standards documents is that nobody really reads them like they should, and when they do read them, they don't follow them. The likelihood of such a document being read and followed varies inversely with its length.
I agree FxCop is a good tool but too much of this can take all the fun right out of programming, so be careful.
Never write your own coding standards use the MS ones (or the Sun ones or ... as appropriate for your language). The clue is in the word standard, the world would be a much easier place to code in if each organization hadn't decided to write their own. Who really thinks learning a new set of 'standards' each time you change teams/projects/roles is a good use of anyone's time.
The most you should ever do is summarize the critical points but I'd advise against doing even that because what is critical varies from person to person.
Two other points I'd like to make on coding standards
Close is good enough - Changing code to follow coding standards to the letter is a waste of time as long as the code is close enough.
If you're changing code you didn't write follow the 'local coding standards', i.e. make your new code look like the surrounding code.
These two points are the reality to my wish that everybody would write code that looked the same.
I found the following documentation very helpful and concise. It comes from the idesign.net site and it is authored by Juval Lowy
C# Coding Standard
NB: the above link is now dead. To get the .zip file you need to give them your email address (but they won't use it for marketing... honestly) Try here
I've just started at a place where the coding standards mandate the use of m_ for member variables, p_ for parameters and prefixes for types, such as 'str' for strings.
So, you might have something like this in the body of a method:
m_strName = p_strName;
Horrible. Really horrible.
I would add Code Complete 2 to the list (I know Jeff is kind of a fan here)... If you are a junior developer, the book comes in handy to set up your mind in a way that sets the foundation for the best code writing practices and software building there are.
I have to say that I came to it a bit late in my career, but it rules a lot of the ways I think about coding and framework development in my professional life.
It's worth checking out ;)
Microsoft's own rules are an excellent starting point. You can enforce them with FxCop.
I would be tempted to enforce Microsoft's StyleCop as the standard. It can be enforced at the build time. but if you have legacy code then just enforce using StyleCop on new code.
http://code.msdn.microsoft.com/sourceanalysis
Eventually it will have a refactor option to cleanup code.
http://blogs.msdn.com/sourceanalysis/
Personally I like the one that IDesign has put together. But that's not why I'm posting...
The tricky bit at my company was taking all the different languages into account. And I know my company isn't alone on this. We use C#, C, assembly (we make devices), SQL, XAML, etc. Although there will be some similarities in standards, each is usually handled differently.
Also, I believe that higher level standards have a greater impact on the quality of the final product. For example: how and when to use comments, when exceptions are mandatory (e.g. user initiated events), whether (or when) to use exceptions vs. return values, what is the objective way to determine what should be controller code vs presentation code, etc. Don't get me wrong, low level standards are also needed (formatting is important to readability!) I just have a bias towards overall structure.
Another piece to keep in mind is buy-in and enforcement. Coding standards are great. But if nobody agrees with them and (probably more importantly) no one enforces them then it's all for naught.
As I wrote both the one published for Philips Medical Systems and the one on http://csharpguidelines.codeplex.com I might be a bit biased, but I have more than 10 years on writing, maintaing and the promotion of coding standards. I've tried to write the one CodePlex with differences in opinions in mind and spent the majority of the introduction on how to deal with that in your particular organisation. Read it and provide me with feedback.....
SSW Rules
It includes some C# standards + a whole lot more.... primarily focused at Microsoft developers
You are most likely being set up to fail. Welcome to the industry.
I disagree - so long as he creates the document, the worst that can happen is that it gets forgotten by everyone.
If other people have issues with the content, then you can ask them to update it to show what they'd prefer. That way it's off your plate, and the others have the responsibility to justify their changes.
I have recently found Encodo C# Handbook, which includes ideas from many other sources (IDesign, Philips, MSDN).
Another source may be Professional C#/VB .NET Coding Guidelines.
I'm a big fan of the Francesco Balena book "Practical Guidelines and Best Practices for VB and C# Developers".
It's very detailed and covers all the essential topics, It doesn't just give you the rule, but also explains the reason behind the rule, and even provides an anti-rule where there could be two opposing best practices. The only downside is that it was written for .NET 1.1 developers.
Our entire coding standard reads roughly, "Use StyleCop."
See this:
http://www.noesispedia.com/post/2008/11/28/C-Coding-Guidelines-and-Best-Practices.aspx.
I have to suggest the dotnetspider.com document.
It is a great and detailed document that is useful anywhere.
I've used Juval's before and that's through if not overkill, but I'm lazy and now just conform to the will of Resharper.
You can check out this,Top 7 Coding Standards & Guideline Documents For C#/.NET Developers http://www.amazedsaint.com/2010/11/top-6-coding-standards-guideline.html hope this helps
I think I echo the other comments here that the MS guidlines already linked are an excellent starting point. I model my code largely on those.
Which is interesting because my manager has told me in the past that he is not too keen on them :D
You have a fun task ahead of you my friend. Best of luck, and please ask if you need anything more :)
The standard from Philips Medical Systems is well written, and mostly follows Microsoft guidelines: www.tiobe.com/content/paperinfo/gemrcsharpcs.pdf
My standards are based on this with a few tweaks, and some updates for .NET 2.0 (the Philips standard is written for .NET 1.x so is a bit dated).
I also follow Resharper.
Also the guide line mentioned on scott guthrie blog
http://weblogs.asp.net/scottgu/archive/2007/10/08/october-8th-links-asp-net-asp-net-ajax-silverlight-and-net.aspx
And
http://csharpguidelines.codeplex.com/releases/view/46280
In the code I write I usually follow .NET Framework Design Guidelines for publicly exposed APIs and Mono Coding Guidelines for private member casing and indentation. Mono is an open source implementation of .NET, and I think those guys know their business.
I hate how Microsoft code wastes space:
try
{
if (condition)
{
Something(new delegate
{
SomeCall(a, b);
});
}
else
{
SomethingElse();
Foobar(foo, bar);
}
}
catch (Exception ex)
{
Console.WriteLine("Okay, you got me");
}
What you might find strange in Mono guidelines, is that they use 8-space tabs. However, after some practice, I found that it actually helps me writing less tangled code by enforcing a kind of indentation limit.
I also love how they put a space before opening parenthesis.
try {
if (condition) {
Something (new delegate {
SomeCall (a, b);
});
} else {
SomethingElse ();
Foobar (foo, bar);
}
} catch (Exception ex) {
Console.WriteLine ("Okay, you got me");
}
But please, don't enforce anything like that if your coworkers dislike it (unless you are willing to contribute to Mono ;-)

Categories