# Thursday, 13 May 2010

Stack Overflow is an amazing resource. It's a place to ask questions and get them answered, but it's a lot more than that. Like any other online community, people get to know each other and some of them start to relax and have fun. In that spirit came the question "What is, in your opinion, the most surprising, weird, strange or really "WTF" language feature you have encountered?" with over two hundred answers. The current highest-voted answer is how C++ is fine with:

10[a]

(for some array a) and it just means the same as

a[10]

I also like the Javascript answer, in which a commenter points out that "111" - -"222" gives 333 and "111" + "222" gives "111222". And another answer I blogged about eighteen months ago. You could spend far too long reading all these and laughing.

Kate

Thursday, 13 May 2010 08:36:27 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 11 May 2010

Programming is not one skill - it's a large conglomeration of skills. Some people are not very good programmers because they aren't very good at imagining their way through an algorithm. Others have great ideas and imagination, but it's painful to watch them type and they can't be bothered to learn how to use their tools (editors, etc) so they just take twice as long as everyone else to create the code. Still others are doing fine until their code does something unexpected, and then things fall apart, because they can't figure out what's going on. They step too soon, spend ages stepping through code that couldn't possibly cause the problem, then get impatient and end up skipping right past the problem. Worse, they don't seem to understand the capabilities of the debugger. I've watched people spend over 5 minutes patiently stepping into so that when they reach a particular line, they know how control reached it. Then I show them the Call Stack window and they say "oh".

I've blogged before about conditional breakpoints and tracepoints, hit counts, and so on. There is so much to the Visual Studio debugger that it is very hard to know it all. But the more you know, the better you are. And what's more, being a great debugger has more value than some of the other programming skills, because so much debugging happens at urgent times, is unexpected, and needs to be done as quickly and efficiently as possible. The difference in impact between being good and great is very large.

So how to be a better debugger? Partly, it's practice, especially practice with someone who's really good. That person can say "hey, what are you doing? Here's a way easier way to get there!" Even practice alone can motivate you to learn how to do something and get you reading the documentation or searching the web. You could buy a book, if anyone even buys books any more. You could take a debugging course, and spend a day or a week with someone who really knows every speck of this enormous tool. Of course, that costs money, travel time, and so on. Some of you will do it, and benefit from it tremendously.

But ALL of you can benefit from watching John Robbins' latest set of videos on Channel 9. It's in three parts and they total about three and a half hours. It hits the ground running and just doesn't stop. It's all using Visual Studio 2010 but the vast majority of the features he shows are in earlier versions too. I knew a lot of it (even the Go To Find box and the file opening etc) but I learned new things in the first ten minutes and continued to learn new things as they continued - both actual capabilities of the tool and interesting ways of thinking, like using hit counts on a breakpoint not to stop, but just to count how much some code gets run. I wish I could get the slides and code, but I guess some things need to be saved for the folks who actually take the course.

If you're a .NET developer, watch these videos. Now.

Kate

Tuesday, 11 May 2010 08:18:59 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 09 May 2010

I often carry links around for a while before I use them in a post. I'm not one of those "here's 53 things other people posted yesterday" types, though I read three of them (Jason, Chris, and Alvin) almost every morning. When I think something is interesting, I'll use it eventually. It's unusual for me to accumulate a lot of links from someone I don't know some other way, typically from having worked with them. But that's the state I find myself in now. Brent Ozar is actually a SQL MVP and I've found plenty of helpful information about SQL on his blog. But these three articles really aren't about SQL:

  • Why I Always Bill By The Hour - mostly about keeping a pleasant relationship and avoiding the blame game, plus not doing things for free just to be nice. We have some clients who run a tab and are charged for time spent, while for most we used fixed bids. What I like most about doing fixed bids is being able to decline work that is out of scope. The big problem with charging by the hour is that people expect that means you will do things when they ask you to. While that might seem fine, I assure you there are times it is not.
  • Salary Negotiations During the Interview - pretty much the exact opposite, for people who don't bill at all but work on salary. Can I just say as an honest and nice employer that it makes me mental when people won't say what they want to make? I had a guy tell me he would be ok with anything between $8 and $40 an hour for a summer job (he was in third year of university.) That is no more a range than "on the planet Earth" is a neighbourhood. I generally pay people what they want to be paid, or else don't hire them. So if you tell me the truth, I'm not going to argue you down from your number. I might decide you're not worth that much to me and so decline to hire you. I might hire you and then give you a 30% raise after 2 months (true story). But I sure won't say "really? I will offer you 80% of that." Ever. I think I might be odd though, because many people utterly refuse to tell me what they want to earn if they work for me. So I like that Brent says "If they keep pressing for your salary, don’t give them your current number – give them the number it would take to get you to switch." That works for me.
  • Rock Stars, Normal People, and You - how you can start presenting, writing, and generally becoming a "rock star" in our industry. There is absolutely no secret to this and there are literally hundreds of people who want to help others get good at this stuff. I like this quote: "Doing this stuff took time out of my personal life, but I was determined to make an investment in my career. I didn’t want to have another really crappy job search, bouncing from headhunter to headhunter, having to re-prove that I wasn’t an idiot and that I was worth money." And this one: "you’re still struggling to get a better job, a better speaking slot, or a speaking slot period, right? You think that Other People are the ones who get book offers, or Other People are the ones who get paid to speak. You’re wrong."

Fantastic advice.

Kate

Sunday, 09 May 2010 13:39:20 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 07 May 2010

Jani Jarvinen (a Finnish C# MVP) wrote a nice article about using sensors with Windows 7. He mixes and matches .NET 4.0 and Code Pack capabilities, and has links to plenty more information. I like the screenshots and the step by step approach. Windows 7 really does make this so much easier than it used to be. He gets you started with both an ambient light detector and some simple location code.

A little more exotic approach comes from "gleat" who has a Code Project article using a Wiimote as the accelerometer. He starts out simple - here's how to download and install the driver - and then goes into writing a client in C#, leveraging Code Pack of course. But then he says hey, were you wondering how to write a driver? and wham! you're hip deep in C++. It's all well explained, though, so if you want to learn more about this, what a terrific way to start.

If all of this is making you wish you had Windows 7 somewhere to play with, but you don't want to buy it, don't have an MSDN subscription, don't qualify for BizSpark etc, then what you need is a free 90 day evaluation of Windows 7, right? I found that link on this handy Doug Turnure blog post from earlier this year that includes some video links I hadn't seen before. Have fun!

Kate

Friday, 07 May 2010 12:14:02 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 05 May 2010

I was just looking up the session codes for my Tech Ed talks next month (my flight to New Orleans leaves a month today, at about this time actually) and spotted something unexpected:

DEV316 | Modern Programming with C++0x in Microsoft Visual C++ 2010
Session Type: Breakout Session

Track: Developer Tools, Languages & Frameworks
Speaker(s): Kate Gregory
Level: 300 - Advanced
Why wait for the C++ committee to finish the specification when you can enjoy much of the power of C++0x today! C++0x, the next C++ standard, is almost upon us and it contains the most important updates to the language since the mid-90s. It even accepts the existence of multiple threads for the first time in the history of the language. Needless to say, these new features bring more expressiveness and power to the native C++ developer. Visual Studio 2010 has added support for some of these key features in order to enable these modern programming techniques. This session clarifies what features are in Visual C++ 2010 and what is yet to come. It illustrates how new constructs such as lambda expressions enable better use of existing libraries and how your code can be simpler, safer, and faster all at the same time. If you are itching to show off how C++ is one of the coolest languages on the planet, this talk is for you!

WCL316 | The Windows API Code Pack: Add Windows 7 Features to Your Application
Session Type: Breakout Session
Track: Windows Client
Speaker(s): Kate Gregory
Level: 300 - Advanced
Accessing new Windows 7 features is a challenge from managed (.NET) code. The level of interoperability required is out of reach for many developers. The Windows API Code Pack for the Microsoft .NET Framework is a sample library you can use in your own projects today that provides access to new user interface features (taskbar jumplists, libraries, sensor platform, and more) as well as "behind the scenes" features that make your applications more aware and responsive (restart and recovery, power management, and more.) Discover a shortcut to Windows 7 development for Microsoft Visual Basic and Visual C# programmers and get started today.

The first digit carries meaning, but the last two don't. So I don't really know how they both got to be 316. Since I often have trouble remembering my session codes, this should halve the effort for me :-).

Kate

PS: I checked whether the Brian rule still applies. You can too, by just dropping down the "Speaker" box on the session catalog page. I'm happy to report there are 9 Brians and I reached 9 obviously female names (ignoring Alex, Chris etc) while I was still in the C's. Good news, in my opinion!

Wednesday, 05 May 2010 13:54:51 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 03 May 2010

The Windows API Code Pack is one of my favourite libraries. For Windows 7 features that are not yet in the .NET Framework, it simplifies access from managed code, saving you from learning how to do interop. And it comes with a nice suite of samples that help you to understand how the feature works and how to use it. I've been incorporating Code Pack into a lot of the modules in my Pluralsight Windows 7 tutorial, and using the samples for demos when they're appropriate. In just a little over 5 months, almost 70,000 copies have been downloaded directly:

The thing is, Code Pack is not a product. You can't call for support on it (though there are discussion and issues section on the Code Gallery page, and people really do read them.) There's no guarantee that there will be more versions in the future. But there are plans for at least one more version, and Yochay is looking for your thoughts on it.

If you ever wanted to add a feature to the Code Pack, were looking for some specific Win32 API to be wrapped, or just wanted to pass us some feedback, this is your opportunity. Please send us your feedback or file a bug using the Discussions or Issue Tracker for the Windows API Code Pack.

He also mentions that about the same number of folks have downloaded other vehicles (eg the Windows 7 Training Kit) that deliver a copy of Code Pack. Those are some nice numbers! Anyway, if you haven't tried it yet, please do, and if you have and there's something you want, please chime in!

Kate


Monday, 03 May 2010 14:46:48 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 01 May 2010

On Thursday night I was the surprise mystery guest for the St Louis installment of the .NET Rocks Roadtrip. What a fun little jaunt that was! We recorded an episode of .NET Rocks, (talking about Windows 7, C++, and educating developers) then Carl and Richard both did very interesting presentations. I had seen parts of Richard's before, but Carl's was all new to me and I will just say if you live in the half of the roadtrip that hasn't happened yet, you really need to make an effort to be there and be part of it!

Here's a blog entry by Nicholas Cloud, and another by Brian Williams, and a picture by fallenprogrammer of us getting set up.

The next morning featured breakfast at Cracker Barrel (an experience) and then a ride to the airport in the RV for me and Kindler Chase, who had joined them in Tulsa, before they headed Chicago-wards. It sure was fun to be part of it!

Kate

Saturday, 01 May 2010 20:22:11 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 29 April 2010

Would you like to learn more about developing for Windows 7 in C# or VB? My Pluralsight On-Demand! tutorial has just gone live. 9 of the 11 modules are there now and the last two will be shortly.

As the abstract says:

This tutorial is aimed at Windows developers (Windows Forms or WPF) who want to add Windows 7 capabilities to their application. The emphasis is on providing a helpful and efficient user experience by hooking into what Windows 7 has to offer. You do not need to know how to interop to native code or how the Windows 7 features work internally.

The table of contents looks like this:

  • Light Up on Windows 7
  • Windows 7 Jumplists
  • Taskbar Overlays on Windows 7
  • Taskbar Thumbnails on Windows 7
  • Network Awareness on Windows 7
  • Power Awareness on Windows 7
  • Windows 7 Libraries
  • Windows 7 UAC and Manifests
  • Partitioning Administrative Tasks for Windows 7
  • Known Folders for Windows 7 (under development)
  • Scheduled Tasks on Windows 7 (under development)

The course has been a lot of fun to put together. I used the Code Pack to keep the amount of code you write to a minimum. Some of the demos use samples that come with the Code Pack; others use my own code, and you can spot those by the Demos download link.

The content is all subscribers-only, but you can get a Guest Pass to check it out. Also, RDs and MVPs get a free subscription, so if you qualify, this would be a great time to use that. Let me know if there are more topics you'd like to see me cover (after I get this one finished, of course!)

Kate

Thursday, 29 April 2010 08:26:26 (Eastern Daylight Time, UTC-04:00)  #