Donovan Lange's Work-Bloghttps://blogs.msdn.microsoft.com/dolange
My name is Donovan Lange. I'm a Software Design Engineer on Microsoft Office OneNote.
This is my work-blog, a place to talk about OneNote, Microsoft, and programming. Geeky stuff. I also keep a life-blog, for the "other" things in my life.Wed, 29 Dec 2010 11:30:00 +0000en-UShourly1SortLines macro for Visual Studiohttps://blogs.msdn.microsoft.com/dolange/2010/12/29/sortlines-macro-for-visual-studio/
https://blogs.msdn.microsoft.com/dolange/2010/12/29/sortlines-macro-for-visual-studio/#respondWed, 29 Dec 2010 11:30:00 +0000https://blogs.msdn.microsoft.com/dolange/2010/12/29/sortlines-macro-for-visual-studio/Ever want to quickly alphabetize a part of your code? I couldn't for the life of me find a way to do this within Visual Studio, so ended up writing my own.

Here's a macro that you can use (and bind to a keyboard shortcut) within your own Visual Studio environment:

For i = LBound(lines) To UBound(lines)selection.Insert(lines(i))If (i < UBound(lines)) Thenselection.NewLine()selection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn)EndIfNextFinally' If an error occurred, then make sure that the undo context is cleaned up.' Otherwise, the editor can be left in a perpetual undo context.DTE.UndoContext.Close()EndTryEndSub

To "install" a macro in Visual Studio:

Launching the Macro Explorer from the Tools menu.

You'll likely have a module created automatically for you on first run, but if not, you can create one. (I call mine "EditingEnhancements".)

Jim Pierson writes about the new Visual Round Trip Analyzer (VRTA) tool that was just released to download.microsoft.com, highlighting 12 easy tips for developers looking to speed up their web applications.

Having been a long-time user of VRTA internally at Microsoft, this tool is simply invaluable. It goes beyond just showing you your time to load, bytes over the wire, and roundtrips -- visualizing the requests over time, port distribution, TCP overhead, bandwith efficiency, and payload compression into a single view. When I sit down to work on our boot performance, this is the first place I start.

There's been a lot of dead air on this channel, and I should apologize for that. We've been hard at work on some new, exciting projects which soemehow have managed to steal all of my free time. Really though, that's an excuse -- mostly I just suck.

For those at PDC in LAX, by now you've all seen the news. Or at least the rumors.

There was quite the buzz around the office today about the newly released Windows Search 4. Amongst other things, this release improves the performance and stability over previous versions of Windows Search (read: the search included natively in Windows Vista as well as the add-on to XP). Moreover, applications that leverage the core windows search infrastructure (such as Outlook and OneNote) should also see a perf benefit as well.

My girlfriend just emailed me. She mentioned that someone at her work saw her using OneNote, and asked her why she liked it. And she wasn't able to give him a very convincing argument (she claimed that was because "she's probably not using it to it's full potential"). As this was the fourth time this had happened to her, she wanted to know where the one page summary of why someone should use OneNote; the top 10 things it does that would help someone the most.

Here was my list:

OneNote allows me to put all of my little bits of information into a single place, organize them how I like, and always be able to find them instantly.

There’s a ton of information that doesn’t naturally have a good home otherwise. Like the URLs I find when researching a topic, or the notes that I take during meetings. Sure, I could use text files and notepad or post-it notes; but I’d have to create my own method for filing them into folders, navigate to the correct file to open them when I want to read them again, make sure I remember to hit Save (and give it a filename) before my laptop battery runs out and I lose my content, etc. It really doesn’t scale when you have a lot of data.

It’s page surface allows me to outline, brainstorm, and collect rich forms of data better than any other tool out there.

Specifically, the ability to click anywhere on the page and just drag-drop any line of text to anywhere else on the page means that I can use this for random brainstorming and when writing out document outlines/drafts. Things that don’t have linear or well-known structures.

Plus, there’s a million features built into the application that allows me to embed non-textual forms of information. So I can use screen clippings (via the Windows + S key) to take a picture of something currently on my screen, or embed a full document via the included OneNote Printer or the Insert Menu, and then annotate on top of that information. And I can find it again, since we’ll OCR the text within the pictures.

Even without a tablet PC, the drawing shapes and click anywhere to type means that I can create simple diagrams without having to load up Visio. With a tablet, I can draw directly on a page, and use a pen when I’m in a meeting where typing may be viewed as distracting.

It works with audio as well. We record the audio for all of our spec reviews using the built-in laptop microphone. Any notes typed during the meeting will be synchronized into the audio timeline for later review. And OneNote will search the speech in the audio file as well.

It’s really good at capturing information quickly.

Sometimes I need to get information written down as quickly as possible. I don’t want to worry about making space in my word document, I can just click anywhere on the page and type.

Ditto for inserting tables. Just hit tab!

I can launch a side-note window (which is a lot like a post-it note) from the system tray and grab down that phone number that someone just spouted off while I’m on the phone.

I can paste web content from a web page and it automatically includes the URL the content came from. Huge time-saver.

I can apply metadata (flags) to my information or create Outlook Task items “in situ” along with the rest of the context that gives that task meaning.

I’m no longer restricted to keeping a single task list in Outlook. When I’m in a meeting, or estimating a feature in OneNote I can tag a line as an Outlook Task, and it’ll create an Outlook Task for me, which is automatically kept in sync as I mark it completed, etc. As a result, all of my ToDo items can live in the place where they’re most appropriate (like in the middle of my meeting notes, or in my shared notebook with you on a page of house projects) and yet have them rolled up appropriately in either OneNote or Outlook.

Outlook Integration, Outlook Integration, Outlook Integration.

In addition to task sync’ing, I find that there’s a ton of information that gets sent to me in email, which should live in OneNote instead. (As email is more of a dynamic source of changing data, vs. an authored knowledge base.) I can send an email to OneNote directly from Outlook 2007 via a single toolbar button click. For someone who tries to keep their inbox nearly empty, being able to store messages like “how to access the internal newsgroups” (for instance) in a Notebook feels much cleaner than keeping them in my inbox.

In addition, I can also take notes about meetings (and have it find my previous meeting notes for a recurring meeting) or keep information about people from my Contact List / GAL in OneNote directly from the Outlook meeting and contact windows. The link between the two stays present regardless of how that gets filed in my Notebooks.

My stuff is available everywhere.

I can’t emphasize how much this rocks. My OneNote notebook is available at work, at home, on my phone (using OneNote mobile) and on my laptop. All I did was point OneNote at a file share or Sharepoint Site, and OneNote takes care of the rest. Plus, it synchronizes embedded documents as well, so I don’t have to use Sharepoint to upload a document or email it to myself. I just drag-drop it right onto the OneNote page, and voila it’s everywhere I need it! No sync’ing, no file locking, nothing. It just works.

Moreover, it works when I’m offline. Even those embedded documents… when I pick up my laptop and go to a conference room in another building, I can still keep typing, regardless of whether or not I’ve got wireless. Go on vacation to the beach, and make changes to my notebook. Whenever it comes online, it all merges back in without any user interaction.

It allows me to collaborate with others.

Word track-changes? Sharepoint edit locks? Yuck. OneNote is a breeze by comparison. Think of it like a Wiki on crack. Everyone just opens up the same Notebook (or Section or page) and just types away. It’s magic.

For those without OneNote, I can create PDFs of my pages, or send a page as an email with a single click. The person on the other end of that email doesn’t even need OneNote to view my stuff.

I can store sensitive information and password protect it.

I generally use this for my personal notebook, but I find it invaluable to store my Credit Card numbers, Bank Account Information, Website Passwords, Frequent Flyer accounts, etc. all in a section that I then password protect. Because the bits stored on disk are encrypted, I can access that file from a server and not worry about the security of the server, across the network, etc.

I can automate repetitive things.

I keep a work journal, and find that it’s really convenient to create a stationary (templates) page which is applied automatically to all new pages created in my Journal section. It’s such a simple idea, but saves me a ton of time.

Not to mention all the cool add-ins that power-users have created that extends the functionality of OneNote.

After much fiddling, it turns out that one can get the Griffin PowerMate to work under Vista. You just need some patience. And a bit of luck.

In particular, you need to:

Run the installer.

Copy the Control Panel Applet, PowerMate.cpl, from the installation media to C:\Windows\System32\. (If you don't have the original installation media, you can use a universal extractor to grab the files from the installer, or just install the software onto a different machine and find all the files by hand.)

Load up the Device Manager and look for the Human Interface Device with the hardware ID "USB\VID_077D&PId_0410". (If you can't find the device, you may need to unplug it and plug it back in as Vista may tag it as non-functional by default.) Choose to update the driver, and browse your computer for the driver software. Opt to pick from a list of device drivers on my computer, and then click on the "Have Disk" button. Select the C:\Program Files\Griffin Technology\PowerMate\Driver sub-directory with the PowrMate.inf and PowrMate.sys.

Run the PowerMate.cpl as an administrator to set all of your powermate settings. (Just browse to C:\Windows\System32\, select PowerMate.cpl and Run as Administrator.) This will ensure that the PowerMate executable, which we'll also run as administrator, loads the correct settings.

Lastly, you'll need to set the PowerMate executable to run in app-compat mode so that it’ll have access to the hardware volume, rather than getting its own independent application volume. Also, you'll need to run it as an administrator. Right click on the PowerMate.exe file and select properties, navigate to the Compatibility tab, and then Show Settings for All Users. Choose to Run this program in Compatibility mode for Windows XP (SP2) and Run as an administrator.

Run PowerMate.exe.

OK, so probably not worth the effort, but there was geek pride at stake here...

BTW, this was also pretty neat. Clearly the answer the next time is to write code to solve the problem.

Now that OneNote 2007 Beta 2 has been out for a couple of days, I'm curious to hear your thoughts. While I'm probably directly responsible for your gripes regarding: Migration, Tables, Drag and Drop, along with the updated UI, I'd love to hear your feedback regardless! What do you like? What works well? And more importantly, what isn't so great? What would you like to see changed?

Also: please report those bugs! Dan Escapa, one of our PMs, posted instructions on his blog about how to go about sending us your pesky issues. Click away. We really do read them.

And for those interested in what's new on the extensibility front, do be sure to check out: What's New for Developers in OneNote 2007 Part 1 and Part 2.

How do you get ride of those extra keyboards and mice? With Synergy, of course!

In the Office org, it's pretty standard for most devs to have at least two machines. You've got your somewhat beefy dev box for coding, an older machine to dogfood builds of Office and check mail, and then, depending on your feature area, you might have the miscellaneous Vista machine for testing, tablet for inking work, etc. I'll admit, it can sometimes be kind of hard to keep track of them all, and harder yet to fit all the keyboards and mice on a single desk.

Plus, I'm pretty fond of my Kinesis keyboard and Trackball Explorer, so it's a real pain to type on something else for long periods of time. And it might be that I'm a bit lazy -- and hate having to lean over to reach a different keyboard. And I can never keep track of what machine that KVM box is hooked up to.

With Synergy, I have my two monitors and tablet sitting next to each other, and just move the mouse between them as if they were a single virtual desktop. In fact, there's only one mouse cursor ever showing, so it feel exactly as if I'm working on a single machine. In addition, I can copy content from one machine and paste it on another with nifty clipboard sharing. Plus, it'll install as a system service, so it starts up automatically at boot and is available from the very login prompt. Best of all, it's not just a Windows app -- if you've got a MacMini at home or Linux box, you can connect them all!

(BTW, if Chris, or any of the other Synergy team members are reading this, my one feature request is automatic synchronization of my "locked" status amongst my machines...)

If you're like me, you'll find Synergy is one program you'll end up relying on, day in and day out, before you even realize it.