Sunday, 16 August 2009
I've mentioned the sensor improvements in Windows 7 a little bit, but they really deserve a good long blog post of their own. Luckily for me, my fellow RD Sondre Bjellås has written it .
This is a handy demo board that does light as well as position (think Wii) with some buttons you can push. Sondre covers where to get the board, where to get the drivers, and a really simple sample app to get you started. Then you're going to want the Windows 7 Training Kit
- the Hands On Labs have some fun demos. Check it out!
Friday, 14 August 2009
What language do you think this
post by Jeff Atwood refers to?
There are over 220 billion lines of <language> in existence, a figure which
equates to around 80% of the world's actively used code. There are estimated
to be over a million <language> programmers in the world today. Most impressive
perhaps, is that 200 times as many <language> transactions take place each day than
Google searches - a figure which puts the influence of Web 2.0 into stark
Wow. 220 billion-with-a-b? B as in Business? As in Business-Oriented-Language? You know, the only thing I like about COBOL (and I have written precisely one COBOL program in the three decades I've been paid to program) is that it made it possible to have a language called SNOBOL.
The comments are full of folks who are maintaining 30 year old apps with a million lines of code, but the thing about billion-with-a-b is that you need 220,000 such folks to hit that number, and what's more as Larry O'Brien points out
20 years ago folks said there were 30 billion lines, and while I can agree that existing apps are being maintained, I don't think there are 7 times as many lines of COBOL out there now as there were at its peak.
But that's not my point. My points is that when you live at the leading edge, the bleeding edge, you forget a really important rule: edges are thin. The handful of us who are moving our apps to 4.0 now, who are complaining about an incompatibility between our Visual Studio 2010 beta and our Office 2010 beta, who are using a language invented this century, are dwarfed by folks who have been using the same tools and the same languages throughout their entire career. These people are invisible because they don't come to conferences, attend user group meetings, buy programming books, or read blogs. Heck, at one of my clients, the AS/400 guys sat off to the side and behind a little wall of cubicle partitions that was double the height of everyone else's. Really. They also never came to all-hands meetings and were exempt from the company-wide .NET training I delivered.
So do these "dark matter" developers matter to the "bleeding edge" developers? I think they do. For one thing, when you have your shiny and exciting idea to change everything about the way some software works, these guys can cancel your whole project with one or two sentences. For another, they are likely the only ones who understand the data format, the business rules as actually coded, and the special cases that come up every 15 to 20 years. Not to mention they can work the text editor. If you find yourself in a situation with some COBOL (or equivalent) developers in it, don't ever tell them you didn't think they existed any more. That's my tip to you.
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.
© Copyright 2019 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Sunday, 20 January 2019 20:54:37 (Eastern Standard Time, UTC-05:00)
On this page....
Pluralsight Free Trial
Click Start a FREE 10-Day trial