Wednesday, 12 August 2009
There was a bit of a kerfuffle in the C++ standards world in mid July arising from the summer meeting of the ISO C++ committee. Agreement couldn't be reached on how to implement concepts. In the end it was decided not to include them in the next version of the standard.
What are concepts? They improve the experience for template consumers. C++ templates are amazingly powerful, but using them can involve a lot of guesswork and a lot of swearing
. They're pretty easy to write, and just by typing a line of code you create a requirement, a pre-requisite, for anyone who wants to use your template. If you write a template that takes two instances of class T called t1 and t2, and then somewhere it says t1 + t2
or t1 < t2
, then your template can only be used with types T that have the operator + or the operator <. Anyone who uses it for some other type is going to get an error message that might be useful, but might be your typical nasty template-related error message. That makes templates easy to write, but hard to consume. Short of actually reading through the code for the template, you can't know before you try compiling whether or not your consuming code actually meets the requirements for using the template.
Generics in .NET deal with this through constraints - the generic writer identifies the interfaces that must be implemented by any type that will use the generic - IComparable or IEnumerable etc. If you want to use the generic, you implement the interface, and the compiler will help you get that done with readable error messages.
So that was the heart of concepts. Some sort of decoration you would put on your template to say "here is what I expect of those that use me." How important are they in general, and how important to C++0x?
- concepts’ presence or absence in C++0x just won’t make much difference to most
users - Herb Sutter
- [concepts were yanked out and that is] a major setback for C++, but not a disaster - Bjarne Stroustrup
- removing them was our best available option both for C++0x and for concepts as a
language feature - Doug Gregor
- Not the end of the world, but disappointing nevertheless - Alex Fabijanic
What do I think? I think that template consumers fall into two large categories - those who consume templates they wrote themselves, and those who consume the STL. If you wrote it, I hope you know what it needs, and if it's the STL, well you can paste your opaque error message into a search engine and someone's blog will tell you what you need to add to your class to use that template. I don't think there are a lot of people consuming poorly documented and sparsely used templates. I agree that concepts could result in that sector growing some day, but that few developers are walking around wishing for them or feeling the pain of not having them. I'm sure it's a disappointment to everyone who put so much work in to them, and who will continue to work on them towards inclusion in a future version of the standard, but the rest of us can relax and get ready to see the other C++0x goodies included in a standard where x might actually fit in a hex digit.
Monday, 10 August 2009
Of course the most important sessions at PDC couldn't possibly be announced yet. The best are the ones that are TBD in the session list and schedule right up until the keynote. That's how you know something big is going to be announced. Imagine something where just hearing its code name, just knowing who was going to give the sessions, or even a single sentence of description would spoil the whole announcement. Those are the sessions you go to PDC for, so it's a bit like a Christmas present ... you can't know in advance what it will be.
But it's a four day conference with a lot of sessions and some of them can be announced in advance. I can see that this year some folks have decided to have slightly more interesting session titles (along with the more traditional titles):
- Zero to Awesome in Nothing Flat: The Microsoft Web Platform and You
- Windows Workflow Foundation 4 from the Inside Out
- Windows Identity Foundation Overview
- Windows 7 and Windows Server 2008 R2 Kernel Changes
- Using Classification for Data Security and Data Management
- Under the Hood with Microsoft SharePoint 2010 Programmability
- The State of Parallel Programming
- The DirectX 11 Compute Shader
- Simplifying Application Packaging and Deployment with Microsoft SQL Server 2008 R2
- Petabytes for Peanuts! Making Sense Out of “Ambient” Data.
- Microsoft Visual C++ 2010: The "Accelerated" Way of Building Applications
- Microsoft Unified Communications: Developer Platform Futures
- Microsoft Silverlight Roadmap and Futures
- Microsoft Silverlight 3 Advanced Performance and Profiling Techniques
- Manycore and the Microsoft .NET Framework 4: A Match Made in Microsoft Visual Studio 2010
- Development Best Practices and Patterns for Using Microsoft SQL Azure Databases
- Developing xRM Solutions Using Windows Azure
- Developing .NET Managed Applications Using the Office 2010 Developer Platform
- Developer Patterns to Integrate Microsoft Silverlight 3.0 with Microsoft SharePoint 2010
- Data Programming and Modeling for the Microsoft .NET Developer
- Building Applications for the Windows Azure Platform
- Automating “Done Done” in the Dev-to-Test Workflow with Microsoft Visual Studio Team System 2010
- Accelerating Applications Using Windows HPC Server 2008
My favourite title in there is definitely "Manycore and the Microsoft .NET Framework 4: A Match Made in Microsoft Visual Studio 2010" but there are other contenders for sure. As for the topics themselves, I think many of us have still not given concurrency/parallelism/manycore the attention it deserves, and all of us are guilty of compartmentalizing what we learn about so I bet you have probably ignored something (Silverlight, or SharePoint, or Azure, or the full power of VSTS). That means these sessions alone will make us better devs. If these titles are enough to get you signed up, do it now
while you can get a $500 (US) discount - from $2095 for the whole conference (except workshops) down to $1595 until Sept 15th. Wait till Labour Day to start bugging your boss about it and the discount will be gone, plus the plane tickets will be more expensive. (Oh, if you're a student or teacher, you pay only $595, which gives you an astonishing way to get head and shoulders above those around you.)
There are also some seriously intelligent workshops scheduled:
- Getting the most out of Silverlight 3
- Patterns of Parallel Programming
- Developing Quality Software using Visual Studio Team System 2010
- Architecting and Developing for Windows Azure
- Microsoft Technology Roadmap
- Software in the Energy Economy
- Developing Microsoft BI Applications - The How and The Why
Four of those seven workshops are being given by RDs, meaning you'll get real world experience along with the technical product knowledge. What a way to get caught up on something you weren't paying attention to!
Going to conferences is getting harder and harder to justify in this climate. But that doesn't mean you stop going to conferences - it means you only go to those that are relevant to your work and offer amazing value (content, people, atmosphere, and otherwise-unavailable bits) in return for your registration fee, travel, and time away from work. The PDC offers just that for devs on the Microsoft stack. It's the only conference I've ever paid my own money to get to. Be there!
Saturday, 08 August 2009
Code Pack, or Windows® API Code
Pack for Microsoft® .NET Framework to use the official name, has hit 1.0 with the RTM of Windows 7 and is now available for your downloading and coding delight. Yes, two registered trademarks in the name, but still technically not a product. It's the most useful not-a-product I know. The mission statement, if you will, of Code Pack is:
The Windows® API Code Pack for Microsoft® .NET Framework provides a
source code library that can be used to access some new Windows 7 features (and
some existing features of older versions of Windows operating system) from
managed code. These Windows features are not available to developers today in
the .NET Framework.
The parenthetical in that description is referring to Vista features like Restart and Recovery and Network Awareness, among others. If you've been playing along throughout the beta period of Windows 7 you probably have three questions:
What's in 1.0 that wasn't in 0.9?
- Shell Search API support.
- Drag and Drop functionality for Shell objects.
- Support for Direct3D and Direct2D interoperability.
- Support for Typography and Font enumeration DirectWrite APIs.
Will my 0.9 stuff work with RTM or should I get 1.0?
- You should get 1.0 because it has some bugfixes in it.
Can I use 1.0 on a machine running the RC?
- Probably, but no guarantees.
To me the biggest thing in this 1.0 release is this:
- The Code Pack also contains sample applications built using this library. Each
sample has a C# version and a VB.NET version and has its own solution file.
That's right. VB samples in 1.0 of something. Thanks for noticing
I am such a huge Code Pack fan (and have had a small hand in its birth) so this is just a wonderful summit to have reached. We've had over 24,000 downloads of Vista Bridge and the pre-release versions of Code Pack, so I am confident a lot of people are able to access Windows 7 features from managed code a lot more easily than they expected to.
Thursday, 06 August 2009
If you like to learn how to do things from material that is longer than blog posts, and videos don't work for you, then you probably still buy books. Here's one you might be interested in:
Authors, in case you can't quite read it there, are Yochay Kiriaty
, Laurence Moroney
, and Sasha Goldshtein
. I am often tempted to link to every post Yochay makes - they are detailed, and useful, and crammed with more links. If you're developing for Windows you should be reading his blog and that's that. I read Sasha's blog regularly, too, and he is constantly coming across things I would never have thought of. I may not need that information that day, but reading it makes me a better developer. Both of them give attention to both managed and native code for extra points from me. Laurence is more a Silverlight guy, but I'm going to read his blog for the next little while anyway.
I haven't seen a preview of the book yet, but it's due Sept 30th, and you know the content will be good. A pound and a half of developer good stuff :)
Tuesday, 04 August 2009
OK, technically you can't upgrade from XP to Windows 7. But that is what the nice guys at Language Log call nerdview
. You can't click a button in the install process that has Upgrade on it and come back later to find that you are now running Windows 7. But you can follow a series of steps that takes you from your current XP installation full of applications and pictures and mailbox and IE favourites and desktop wallpaper and all that jazz, and end up with a Windows 7 installation full of all the same stuff. Well, not your applications, but all your data and your settings. That feels like an upgrade to most people, and if the applications they use are free (Messenger and other downloadable clients) or they have the installation materials and they only use 3 or 4 apps (say, Office) then this is a really simple process to follow. Scott Hanselman has all the details
complete with screenshots and instructions.
Me, I'm going to repave. In fact I never fully paved when I went to RC - I've been using Remote Desktop to get to other machines around the office that have Visual Studio etc installed. That was mostly because I'd been through two hard drive failures in as many months and was suspecting the controller was wonky. This drive has lived long enough that I'm willing to install stuff on it now, so there's plenty of installing in my future :)
Sunday, 02 August 2009
I hate SharePoint sometimes. It's powerful, and strong, and free(ish) and does an amazing job. If you just want to install it and use it, there's really nothing to complain about. But it's greatest strength, and my greatest user-upper of swearwords, is that you can program against it. With each release, whatever I swore about last time is magically fixed (RunWithElevatedPrivileges FTW) but a whole pile of new misery sneaks in out of nowhere. (Well, and CAML remains, but I guess we can't do anything about that.) It's usually related to security, but not always, and the thing is that debugging it is always like surgery with oven mitts on.
I had a situation where I wanted to find the item you just added. Took a little searching, but I found it:
query.Query = "<Where><Eq><FieldRef Name='" & list.Fields.Item("Created By").InternalName & _
"'/><Value Type='User'>" & SPContext.Current.Web.CurrentUser.Name & "</Value></Eq></Where>" & _
"<OrderBy><FieldRef Name='Created' Ascending='FALSE' /></OrderBy>"
items = list.GetItems(query)
The first entry in items is the thing you most recently added. OK, fine. But we have event receivers on these lists, and they go off asynchronously. That means that right after you saved an item, while the receiver is still processing, the item isn't returned by the query.
Well that made me grumpy but I understood, so I made a loop, and if the first entry in items wasn't recent enough (say, in the last two minutes) I would have a little sleep and then ask again. But no matter how long I waited (even 20 minutes!) this code never would find the item. Oh, there was swearing, you can be sure of that.
I decided that SharePoint must be caching the query results. But searching for things like "SPListItemCollection cache" just got me helpful tips on caching these results myself, some thread safety issues, and the like. For example, this MSDN article
You might try to increase performance and memory usage by caching
SPListItemCollection objects that are returned from queries. In
general, this is a good practice; however, the
SPListItemCollection object contains an embedded
SPWeb object that is not thread safe and should not be cached.
Does that match up well with what I am seeing - always the identical results from this query-in-a-loop even though I know the underlying list has changed while the loop was running? It does not.
Then I found two blog entries by Jeff Crossett: first the complaint, and then the solution. He's right. And when I implemented his hack:
' use a random value in query so we don't get cached.
randomValue = generator.Next(100, 1000000000)
query.Query = "<Where><And><Eq><FieldRef Name='" & list.Fields.Item("Created By").InternalName & _
"'/><Value Type='User'>" & SPContext.Current.Web.CurrentUser.Name & "</Value></Eq><Neq>" & _
"<FieldRef Name='Title' /><Value Type='Text'>" & randomValue.ToString & "</Value>" & _
"</Neq></And></Where>" & _
"<OrderBy><FieldRef Name='Created' Ascending='FALSE' /></OrderBy>"
items = list.GetItems(query)
We all lived happily ever after. Well, until the next WTF that SharePoint throws my way. I am doing amazing things with this product. My customers would pay more for their software if SharePoint didn't exist. But man, sometimes it is HARD.
Friday, 31 July 2009
It's time to start talking about TechDays (because among other things, I'm talking at
Joey has the details
including a list of sessions. I'm in the Core Fundamentals and Best Practices track in Toronto, delivering these two talks:
Day 1, Session 1:
Tips and Tricks for Visual
This session enhances your experience with Visual
Studio. Keyboard shortcuts, macros, layouts, fonts, tools, and external
utilities are all very powerful and underused features of Visual Studio. This
session makes you more productive in Visual Studio. Bring your pen and pad
because you'll definitely want to take notes!
Day 2, Session 4:
Database Change Management with Team
If you develop database enabled applications on top of
SQL Server, you owe it to yourself to considering doing it better with Visual
Studio Team System. In this session, you’ll learn about changes to how the
product works under the covers and what that means to you. Then, you’ll learn
how to use the product to design, build, and deploy your databases to
development, test, and production environments -- all with purpose and method
instead of the more traditional madness that can be found in many shops in the
I am a huge Data Dude fan, which makes the second session a natural, and as for the first one, I'm one of those people. When I present I'm nice and careful with lots of mouse clicking so everyone can see what I'm doing. But when I'm sitting down to code, I get a pretty constant chorus of "hey, how did you do that so fast?". Come and see how .
Wednesday, 29 July 2009
I didn't even know there was a Visual Studio Project Team blog, but the entries lately sure have been C++ relevant:
Brian Tyler says "Our areas of responsibility are those surrounding projects and solutions in
Visual Studio - specifically the C++, C# and VB project systems - but we're
involved in other code bases in those areas as well." and explains that he's going to start the blog with these C++ topics because the conversion of the VC++ project system from VCBuild to MSBuild was a major effort in VS 2010.
I'm really happy about the VC directories thing. It made moving projects from one machine to another very brittle that things like which version of a header file you got were machine-specific instead of project specific. The blog as a whole is a must-read if you're going to do any C++ work in Dev10.
© Copyright 2018 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Friday, 21 September 2018 12:22:30 (Eastern Daylight Time, UTC-04:00)
On this page....
Pluralsight Free Trial
Click Start a FREE 10-Day trial