# Tuesday, 24 June 2008

P/Invoke (aka DllImport) signatures are not the world's most fun things to create. You start with a native declaration, and then hand-map native types to the equivalent (you hope) managed types. If at all possible, you head to www.pinvoke.net and look up the API you are calling and paste in whatever some kind soul put on the wiki. If not, well you have some mechanical work to do.

But now the Interop team has a little tool for you! Look up the API you want, choose a language, click the Generate button and -tada!- your declaration is ready to be copied and pasted. (Even has doc comments explaining the params.) Not calling a well-known API (maybe it's your own code from a native project?) No problem, paste in your native C++ signature and translate. Need to go the other way around (what native signature corresponds to a managed one?) No problem.

Sweet. The code it generates isn't pretty (for example it doesn't add any using/Imports statements, so everything gets the full dotted name every time, and everything is explicitly declared) but then again, who reads generated code? Stick a comment in front of it saying you generated it and leave it alone. Even if it needs a little hand tweaking now and again (and I honestly don't know whether it does or not) it will still save a TON of time. It's on CodePlex, so go get it.

Kate

ps: The list of APIs is in a XML file, and I noticed the Vista-only ones I tried (restart and recovery related mostly) weren't found, so if you wanted to make a contribution to the project...

Tuesday, 24 June 2008 19:56:13 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 23 June 2008

I said I would post it when I got it.

Wow. Almost as amazing to me as being in a picture with Bill is being friends with so many of the others in the picture. What a day that was.

Kate

ps: I know it looks like most of us are all wearing the same light blue shirt. We're not. Stephen, Scott, and I are all wearing Tech Ed speaker shirts, because we were speaking that day. Across the front row, Dave is wearing his Culminis shirt (it's a slightly different blue) and Morgan her INETA shirt. Dan is actually in a white shirt that is reflecting Morgan's shirt. Unfortunately I can't remember whether John (behind Morgan) was wearing a speaker shirt for sure, but I think so.

Double ps: updates from Rob Zelt and John Holliday.

Monday, 23 June 2008 18:28:29 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 22 June 2008

So imagine you have some managed code, and it calls some other managed code, and that lower level code tries to do something that requires a certain level of code access security. Maybe it wants to write to the files system, or open a network connection, for example. You probably know that there is a stack walk to make sure that everyone has the appropriate permissions. But what if that stack includes some native entries? Managed code called native code (maybe with P/Invoke; maybe with IJW-style C++ interop) and then the native code called managed code (probably with COM interop though there is also "reverse P/Invoke" I suppose. What happens then? Shawn Farkas knows. The whole blog is good reading if Code Access Security and the way the runtime actually works are things you should know more about, but haven't investigated. Bite size pieces of intruiging questions, along with definitive answers. Nice.

Kate

Sunday, 22 June 2008 13:54:08 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 21 June 2008

When I interview people, I throw them lots of softball questions. One of them is "why should I hire you?". Some people think this is a scary and difficult question. On the contrary, it means "here is your invitation to tell me why you are right for this job. Feel free to brag as much as you like. I will now listen while you tell me what is good about you. Extra credit if you have some clue about what is valuable to me." Interview questions just don't get any softer. Yet some people blow it. They answer a different question, usually "why is it important to you that you can work here?" but occasionally "why do you want to be employed?". Fascinating information may come out of your mouth, but it isn't what I asked for. This of course means that I learn something else from your answer - something about your attention to detail, your ability to think of my needs instead of your own (and if you join us, to think of client needs), and your grasp of the business picture here.

Another question that terrifies people is "tell me your biggest weakness." I generally don't ask this because you just get "well I am a perfectionist, I must have all my work complete and beautiful" or "I work too hard I am so devoted" or "my brilliance shines so brightly that it scares others" or the like - bragging disguised as modesty. I already have a question which prompts you to brag. But the other thing is that not all weaknesses are things you actually need to improve or fix. For example, I sing poorly. I have arranged my life so that this doesn't matter. I would never raise it in a job interview. (If I was interviewing for Canadian Idol, it would be a big deal though, wouldn't it?)

If you do get this question, you want to provide an answer that is honest, that identifies something relevant to your workplace, and where you can say what you are doing about it, but more importantly what you need from them about it. "I work long hours and can tire myself when I get caught up in an exciting project. I really value firms that track overtime hours and give me an extra day off from time to time to acknowledge those long days and let me recharge my batteries." "I have very high standards and when I was younger every client got a Cadillac even if we bid a Pinto. I have learned the importance of requirements and project plans to keep my work in scope and make sure I solve the problem we are tackling in the time we have allowed, but it's still a weakness that I can be vulnerable to scope creep." "I think very quickly and solve problems faster than most people, but I can forget to make sure my colleagues are with me and that we have consensus. I work best in an atmosphere where at least one person can keep up when my mind takes off, and remind me to explain my thoughts to everyone."  These answers genuinely reveal something about yourself that would be a fatal flaw in some companies. The thing is, if they're true (and not something you made up thinking this was the "please brag" question) then you don't want to work in those companies. Revealing this weakness will save you from a miserable job. They also set a requirement on the interviewer. Will you give me time off when I have been working long hours? Will you have the discipline and project management to help me stay in scope? Am I doomed to be the smartest person in the room every time? Let the firm assure you (if they can) that they will be a good fit for you.

Take some time to think about your true weaknesses. Lack of experience, impulsive or overly rigid actions, ignoring procedures or refusing to ever deviate from them, freezing out slower thinking colleagues or never making a decision or offering an opinion without checking with everyone else first, skillset that's a little old fashioned, slow learner, new thing junkie, continuous partial attention, tendency to go dark, hesitant to ask for help, afraid of public speaking, horrible grammmar and spelling, everyone has something. Take your time and construct a reply that honestly states your true weakness, then explains the environment you need to thrive given that you are this kind of person. If you like, include something about how you are strengthening that part of yourself already, if you are. Or if that's just who you are (like my singing) don't pretend you plan to fix it. Resolve not to work for firms that can't support you in your weak areas. Never pretend just to get employed.

Kate

Saturday, 21 June 2008 22:54:44 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 20 June 2008

Well, to be honest, the BBC probably didn't sit down and say "We hear Herb Sutter and the gang are going to show Bill Gates all about their plans for lambda functions in C++0x, we have got to get on a plane and capture footage!" They were probably like everyone else "blah blah retiring blah blah career retrospective blah blah dig out those embarrassing old photos" but they happened to capture this meeting. And I actually quite liked the entire episode, really. It's an hour long, stuck up on YouTube as 6 ten-minute segments and a 6 minute one (As each ends you'll get links to the next.) The review meeting with the C++ team gets splonked in repeatedly in between the stuff you've heard a million times about the founding and the dropping out and the early big sales and so on. But there are things I hadn't heard, like just when that picture of everyone looking impossibly young, geeky, and hairy was taken, or how they re-enacted it years later. It's an entertaining and informative recap.

I spotted Herb, Soma, Bill Dunlap, and Ronald Laeremans in the meeting. Any sharper-eyed people who can provide more names?

Kate

Friday, 20 June 2008 22:29:37 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 19 June 2008

Jim Bolla has a list of questions to ask someone you're thinking of working for. Some of them are just kind of warmups to get everyone in the mood, and honestly I would expect the employer to volunteer stuff like "what our organization does" and "how IT helps us do that more effectively" in the little speechy bit at the beginning. But absolutely, if you get to the "do you have any questions" part and you still aren't clear on what the company does, it would be very wise to ask. After that we get into some really good stuff. If you're unfortunate enough to be interviewed by HR you may not be able to push hard on their source control or continuous integration strategy, but you will want to. These are the details that add up to whether you will like the job or not. I know because I come in to mentor these people when they are unhappy and unproductive, and these are the things I end up telling them to change :-).

Kate

Thursday, 19 June 2008 22:18:03 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 18 June 2008

Recently, a young man who has just completed his post secondary education (programming etc) asked me for help connecting to local communities. He's looking for work and he knows from experience that networking and connections are vital. But out of the college atmosphere, it's not always clear where to find people. I suggested user groups, of course. For those of you who live vaguely north-and-east of Toronto, as I do, I suggest:

  • The East of Toronto .NET Users Group. I founded it because I didn't like driving all the way to Mississauga for user group meetings. Chris Dufour runs it brilliantly. Expect speakers from Microsoft, INETA speakers from all over North America, me once or twice a year, plus pizza for everyone and door prizes for a handful of folks each meeting. Meetings are generally in Oshawa or Whitby.
  • Durham Personal Computer User's Club. More consumer focused than developer, but industry speakers do come and you will meet geeky people in the area. I recognize several names on the speaker list as possible employers of new graduates. They meet in Courtice.
  • The Kawartha section of CIPS. Enterprise focused in many cases, IT Pro material as well as developers, and excellent networking opportunities. Meetings are generally in Peterborough and once a year (in January) they specifically hold a meeting for upcoming graduates to talk about employment topics.

It's quite likely that there are Java or PHP or Ruby user groups nearby; if you know of any please leave a comment. Unfortunately most groups suspend meetings for the summers, so it may be a while until they are meeting again. Still, meeting other people is the best way to find a job you will love. Remember, when someone is looking to hire, they aren't doing you a favour - they're meeting their own needs. They will count themselves lucky they met you, or were introduced to you.

Kate

Wednesday, 18 June 2008 22:09:47 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 17 June 2008

A long time ago, C++ MVP Bruno van Dooren started a new job. He blogged about why the procedures they follow are important:

We make medicine. Ours is injected directly into the bloodstream of patients who are already weakened by their condition. It goes without saying that there is absolutely no room for making mistakes. Any possibility for error has to be eliminated.

Most of us don't have stakes quite that high, but we work in environments where mistakes should not happen. And yet, they do. And more importantly, every once in a while a cascade of mistakes (I typed something in error, then I didn't run the tests because it was such a small change, then someone else just copied without checking etc etc) means that something bad actually happens "in production". Our procedures are designed to prevent this - the bad cascade happens when people don't follow procedures.

I've found that everyone sets procedures aside some of the time. Heck, if you have something wrong in production at 7pm Friday night, you don't leave it like that because you can't raise a second person to sign your release form, you fix it, and you do the release form Monday. And some procedures seem to be always ignored, which is a sign (when I have my I Own The Company Hat on) that they should be changed. But what interests me is that some people almost always ignore procedures, even good and helpful procedures that everyone else follows. Why would that happen?

I don't have a lot of data on this. People don't like to sit down for an open and honest chat with their boss about why they don't do things the approved way. In fact, most folks who never follow procedure go to some trouble to make it look as though they do follow it. What's more, once I become aware that someone routinely ignores a procedure and hasn't come forward to suggest it should be changed, our opportunities for conversation tend to dwindle, since they're usually busy with a new employer :-). But it seems to come down to one of three things:

  • The procedure takes a little extra time. The person is selfish or lazy or both, and skips that time. The pain the procedure saves is not their own, so they would rather have the time to either do other work and look very productive, or relax at work and have more free time. Sometimes this is a cue to me to reduce the time that the procedure adds, but not always. If you had a developer who took the read only flag off all source files so as not to be bothered with the time it takes Visual Studio to check those files out on edit, would that be OK?
  • The person doesn't know or understand the procedure, or doesn't believe that management will change the procedure if they come forward and suggest a better way. This is why we all suffer through endless "presenting the new procedure" meetings. How else can you tell people? How else can you make people believe? Thing is, I don't know anyone who was actually convinced by a "presenting the new procedure" meeting. I do better by following it myself (tough, because for many tasks in the firm I only get near them in those emergency "I'll do the forms tomorrow" situations) and by paying strict attention to whether others are following. I also need to be more transparent about "presenting the new procedure that was changed because X convinced me this new way is quicker but still prevents errors".
  • The person has discovered a way to do the tasks that is quicker or easier, and still prevents errors, (or maybe that prevents more errors, or whatever) but actively doesn't want the rest of the firm to know it. A sort of "I'm all right Jack" approach that makes that person more productive and perhaps more promotable, but does the firm as a whole no service. I often find out about this only long after the person has "left to pursue other opportunities" since hoarding information and increasing your personal success only are not paths to promotion with me, and this behaviour tends to show up consistently in many things the person does.

Of the three, the hoarding one is the hardest to deal with as a manager. Believe me, you will get more gold stars for having the idea that made your whole department faster than you will for being the fastest in your department. Even if, after your new procedure is implemented, you are somehow second fastest, I will know whose brain is saving/making me money.

Kate

Tuesday, 17 June 2008 07:53:23 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 16 June 2008

So you have your app on Vista now and it's working great. It needs to elevate maybe? Or part of it does? And do you cringe a little when you see that An Unidentified Program Wants Access To Your Computer super-scary version of the UAC consent prompt? Would you like to stop being called Unidentified Publisher? Well then you need to sign your application. But how do you do that? How much does it cost? Isn't it hard?

I seem to only have questions in this particular post. Well John Robbins has answers. Check it out. Try it. Let me know if it worked for you.

Kate

Monday, 16 June 2008 23:47:47 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 15 June 2008

This fall there will be a PDC. Yay! What will it be about? Some hints are starting to emerge. I predict you will hear the word Cloud a lot. I predict things I blog about pretty regularly will get some serious coverage. I predict I will be there. That one's a sure bet actually ... I'm registered and everything.

http://microsoftpdc.com/

Yeah, I know, LA again, but hey! It's the PDC! How bad can that be?

Kate

Sunday, 15 June 2008 23:35:01 (Eastern Daylight Time, UTC-04:00)  #