shahine.com/omar/

homepage | Send mail to the author(s) contact

yet another Microsoft blogger

# Sunday, May 02, 2004

dasBlog 1.6 released

I've released dasBlog 1.6. You can read the release notes and the new features and bug fixes.

There are many flavors for the the bits on the dasBlog workspace.

In short, there are many bug fixes, Atom 0.3 support, even better Search feature, some new macros, better permission failures, perf enhancements, log file archiving and some others.

Special thanks to all the workspace contributers for all their work!

On another note. I'm not sure I can bear doing another release on GotDotNet. I love GDN for some of my smaller projects, but it took me over 4 hours this weekend to checkout/checkin the entire source as well as upload 5 releases. Using the Windows Forms interface for GDN is like watching a turtle do the 400 meter dash.

Posted Monday, May 03, 2004    Permalink    Comments [4]  View blog reactions

 

# Saturday, May 01, 2004

Dental technology

I have some of the worst teeth in the world. My dentist makes about $2000 to $3000 bucks a year off my insurance and out of pocket. Each year for the past 5 years I've averaged at least one crown and 1/2 a root canal (yes I brush my teath and floss, but it's genetic). Getting a crown isn't very fun but yesterday I saw the coolest thing.

Usually when you get a crown it goes like this:

  1. Take impression of teeth
  2. Drill Drill Drill
  3. Take impression of little nubby left
  4. Make temporary crown and spent like 30 minutes adjusting it so your bite isn't high
  5. Return in 2-3 weeks when new porcelain crown has been made
  6. Remove cemented temp and adjust new crown (which is always too big) for 1 hour.
  7. Cement new crown and adjust bite.
  8. More than likely you don't make it to step 7. Something is wrong with new crown. temp goes back on and repeat 5-8.

Well no more. My dentist has this amazing CAD/CAM system where they make the crown right in the office. It goes like this:

  1. Spray powder on tooth
  2. Take 3D Image of tooth
  3. Drill Drill Drill
  4. Take image of little nubby left
  5. Spent 30 min or so designing new tooth on computer in 3D
  6. Send to CAM machine that creates new tooth out of a porcelain block in under 15 minutes.
  7. Adjust crown and cement.
  8. Adjust bite.

Simply awesome.

BTW, my dentist, is Sam Thacher. If you live in San Francisco I highly recommend. Tell him I sent you ;-).

Posted Saturday, May 01, 2004    Permalink    Comments [4]  View blog reactions

 

OneNote Powertoy: Rss2OneNote

Here is a sneak peek at my second OneNote PowerToy.

This is a cool little application. Basically you can launch it, enter an RSS feed (all flavors supported) and click download feed, select the posts you want and send off to OneNote.

I’ve also added a little context menu in IE (thanks for the pointers Greg!) that will launch Rss2OneNote and download the feed. Lastly, I added an option to create a new section based on the Feed Title and create a page for each blog entry.

I took special care to handle some Html nasties that OneNote doesn’t deal with very elegantly (mostly issues around whitespace, <pre> tags and so on).

One thing I got to do when writing this was to create a simple RSS class library. Parsing RSS is actually pretty simple. I used XPath to do it and so far it can handle everything I’ve thrown at it. I’m sure it isn’t as robust as RssBandit or NewsGator but it does the job.

Are there any features you’d like to see? The only remaining work item for me is to use the guid attribute of a post to update the entry if it’s modified rather than re-creating it over again.

Oh, I even created the icon :-)

Posted Saturday, May 01, 2004    Permalink    Comments [3]  View blog reactions

 

# Friday, April 30, 2004

How to replace notepad.exe with notepad2.exe

Thanks to some great comments and a specific one from James I have now replaced notepade.exe with the vastly superior notepad2.exe and prevented Windows File Protection from replacing the new notepad.

Here are the steps (warning, process with care, no warranties etc):

Method 1

1) Rename Notepad2.exe to Notepad.exe
2) go to %windir%\system32
3) Rename Notepad.exe to NotepadX.exe
4) go to %windir%\system32\Restore
5) Turn off hide invisible files in Tools->Folder Options->View
6) Select filelist.xml and right click->Properties and uncheck Read-only
7) Edit the file
8) Add:

<REC>%windir%\notepad.exe</REC>

to:

<Exclude>
    <REC>%windir%\system.ini</REC>
    <REC>%windir%\tasks\desktop.ini</REC>
    <REC>%windir%\win.ini</REC>
    <REC>*:\AUTOEXEC.BAT</REC>
    <REC>*:\CONFIG.MSI</REC>
    <REC>*:\CONFIG.SYS</REC>
</Exclude>

9) copy the newly renamed notepad2.exe (now named notepad.exe) to %windir%\system32

note: it turns out that for some folks, this doesn't work. It did not work for me on my tablet pc. Thanks to Shakeel Mahate here is method #2.

Method 2

  1. Tools->Folder Options->View uncheck Hide protected operating system files. 
  2. rename Notepad2.exe notepad.exe 
  3. copy notepad.exe %windir%/system32\dllcache 
  4. copy notepad.exe %windir%/system32 
  5. A dialog will popup hit cancel 
  6. Recheck Hide protected operating system files in the Folder Options dialog box

The dllcache contains copies of the windows protected files. The dllcache isnt itself protected.

Posted Friday, April 30, 2004    Permalink    Comments [6]  View blog reactions

 

Microsoft Culture and why I love it

Chris Pratley has this little gem in a series on Word that he is writing. He really captures why I am so drawn to the company and why I have always enjoyed working here.

"The idea that I would need "permission" to have a blog is a little humorous to me. Microsoft  has always had as one of its strengths that it gives enormous freedom to its employees. We don't have time cards, no one tracks our hours, and in general we are given a lot of responsibility. As long as we deliver results, it doesn't matter if you come in at 2pm and don't wear shoes (both of which I do occasionally, although less often than I used to).

In a way, the environment in any product group is more like a startup than a big company. We have small teams of dedicated people who don't need rules and oversight to make them perform. In fact, if such bureaucracy did start to creep in, the best people would simply leave - it wouldn't be fun anymore. Microsoft is consistently rated as one of the top places to work in America - even though our salaries are only a little above average and the stock has not gone anywhere exciting for several years. The reason is that the environment is great, the benefits are great, and the typical passion, commitment, competence and intelligence of the people around you everyday is exhilarating, frankly. I mean, I LOVE my job. What could be better than working through tough technical problems with smart people everyday, working with customers to understand their needs and then delivering what they asked for (take a look at OneNote's SP1 - that was a tremendously fulfilling release for our team thanks to the users out there who have told us how much it improves their use of the product, if not their lives). Not to mention designing and building products that are used by hundreds of millions of people the world over. If you can make those even a little bit better, the impact you have is enormous."

Posted Friday, April 30, 2004    Permalink    Comments [0]  View blog reactions

 

# Thursday, April 29, 2004

Even better notepad.exe

From Roy Osherove.

Notepad is one of the apps I  use most on Windows. It's especially handy for removing formatting from text, storing quick snippets and so on. However, it was probably written in 1995 and hasn't changed since.

Notepad2 is a FANTASTIC app, has a toolbar with buttons ;-), looks like it belongs on XP and is free! You can even set the window to be transparent. It's got a ton of awesome features.

I just copied it to C:\WINDOWS so I can open it from the command line. You can't actually replace notepad.exe cause Windows File Protection will restore the original version.

Posted Friday, April 30, 2004    Permalink    Comments [4]  View blog reactions

 

Simply hilarious flying experience

It takes like 15 minutes to read the story of Sean Mendis's flight through STL-CMI-ORD-PIT-JFK-LHR-JFK-BOS-ORD-MKE-STL-SGF-DFW-SAN-LAX-SBA-LAX-MSP-DTW-ATL.

So funny. Thanks Dennis!

Posted Friday, April 30, 2004    Permalink    Comments [0]  View blog reactions

 

Windows Forms 2.0 Simple Multithreading

Check out the new BackgroundWorder component. This is so very cool. I've had to do similar things in at least 5 different projects I wrote in the past year. It's great that this stuff will be built into Windows Forms 2.0. It will sureley save me a bunch of time.

Posted Friday, April 30, 2004    Permalink    Comments [0]  View blog reactions

 

Getting Things Done 2 months later

It was about 2 months ago that I started using the Getting Things Done system. First I bought the book, then I got the software, then I organized my life and now I'm a lot happier for it.

LauraJ just wrote a post on how GTD has impacted her, and Marc's blog has many useful posts on the subject. I feel almost exactly the same was Laura does, so read her post and then come back to mine. Also check out some of Marc's articles:

First of all, if you are like me you used to have a work style where you were constantly scanning your inbox for things to do (and then procrastinating because it was overwhelming). You thought you had everything you needed to do stored away in your head and you've been fairly successful "Getting Things Done" but at the end of the day you were constantly assessing what was in your head, what was in your inbox, things you needed to do... always thinking about things you needed to do. This leads to stress and constantly being on mail. In a culture like Microsoft where people one office over will e-mail you before walking to your office (we have these strange device on our desks where you can speak to some one far away and they speak back, but no one uses them).

I didn't realize how badly my "system" was this was till I read the book. The analogy is that you are keeping all this stuff in RAM, and constantly looking for it. You end up feeling guilty when you don't get to something because you feel like you've broken a "contract" with yourself. A better way to do things is to store them away in a secure system. By secure I mean a system that you trust will capture every single actions you need to take for any given project. It's trustworthy because you no longer have to remember the actions you need to do, and know that they are being managed by software or whatever.

Here are aspects of the GTD philosophy that have really worked well for me. I love the software because it makes it easy for me to use the system, and in some senses kind of fun. Checking off tasks that are really e-mails underneath (actionable e-mails) is kind of fun. And that small amount of fun makes me actually continue to use the system.

Email - using the GTD software for Outlook + Outlook2OneNote

  • Deal with any piece of e-mail that takes less than 2 minutes. Just take care of it right there and then.
  • Delegate anything that you should and create a task for follow up.
  • Creating tasks that are actionable for anything else that needs to get done at some point (not time critical)
  • Creating calendar events for anything else that needs to get done before or on a certain date.
  • Creating someday tasks for interesting e-mails to follow up on some day (you don't need to do these things, but you want a place to store them and act on later one). You get rid of the e-mail this way. I had tons of these things in my inbox before.
  • Create a page in OneNote or file any other reference type material. This is where my Outlook2OneNote PowerToy comes in handy (and why I created it). Make it easy to find later by organizing it in a project or subject based folder or section in Outlook or OneNote.

Paper, Files, Mail anything else

Based on techniques described in the book, I went out and bought a top of the line Brother Label Maker that can make Manila style labels. I bought 200 or so manila envelopes and filed every single piece of loose paper as well as tossed every hanging file folder I had and replaced them with manila files. It's amazing how much more you'll tend to file something if it takes less than 1 minute to do so. That's not possible with the hanging file folders, and that is what makes the system work so well. Plus you can store many more manila files in a drawer than a hanging file folders, they are also easier to transport.

Every manila file is placed alphabetically in my file cabinet. I don't hesitate to file a single piece of paper if I need to. I just grab the label maker and do it. It feels great knowing that the barrier to being organized is so low. I was very ad-hoc about this before and again, it was another system that I didn't trust.

I did this both in my home office and at work. My desks are empty, no lose papers, and it just feels good.

Results

The end result of this is that I feel less stressed. I know what I have to do and I no longer remember it. Each week or so I scan my task list and figure out when and how I am going to do things based on context. This concept is explained in the book so I won't go into it here. The beauty of the system for me is that it really only took a little bit of structure, and a little bit of software, and I have a system that makes me feel less stressed out, allows me to think and plan better, and generally frees up my brain to do better things than constantly assessing the same things over and over. Even better is that it helps me use the tools I know and love (a Personal Information Manager) to use a task list and a calendar in a manner I never did before. Why shouldn't you make appointments with yourself to do certain tasks? At ms where we use free/busy a lot it's a good way to tell people not to make any appointments with you at this time. The task list was something I never used before (tried to many times and failed). Not that e-mail = task and there is a strong correlation between the two they are more actionable and granular. My old tasks were like "finish project". Not actionable and they stick around for ever.

Lastly, I can't express how amazing it is to go home every day with fewer than 10 items in my inbox. I used to be consistently in the 100-300 messages range. The book only costs like $15 bucks and doesn't take long to read. It will pay for itself very quickly.

Posted Friday, April 30, 2004    Permalink    Comments [1]  View blog reactions

 

Great Smartphone companion desktop application

Wow, this is something I've always wanted on my PC. Jeyo Mobile Companion lets you send, receive, and generally manage your SMS messages on your Windows Mobile Smartphone. You can also manage your call history I just installed it and it seriously rocks. The only feature it seems to be missing is a notification of sorts when you get a new sms (like the Apple AddressBook). Anyway, the application is very well designed, installs well, and generally meets my bar for being a good windows application.

It advertises the following features:

  • Support any Windows Mobile Smartphone or Pocket PC Phone Edition device
  • Send, receive and search SMS messages from a Windows PC
  • Organize contacts in a Windows Mobile device''s memory or on a SIM card
  • Backup and restore SMS messages or contacts
  • View call history
  • Install applications and homescreen themes on a Windows Mobile device
  • Take screenshots of a Windows Mobile device
  • View a Windows Mobile device''s system information

Posted Thursday, April 29, 2004    Permalink    Comments [0]  View blog reactions

 

Opening Acrobat PDFs in IE

As I just mentioned, there is a way to make Office documents open in their respective apps rather than IE. Since PDFs are quite common on the net I am always getting annoyed when they load in the browser for many of the same reasons I mentioned earlier today.

The double whammy to PDFs loading in IE is that they are not entirely downloaded. So for a multi page PDF file you have to wait a long time to page around and in many cases this freezes IE which makes me extra grumpy (try searching, even worse). There is a preference in Acrobat Reader to both disable the opening of documents in the browser as well as disable the loading “feature” (I'd call it a flaw). Here is how to do it:

  1. Launch Acrobat (why oh why does this take FOREVER!!!)
  2. Go to Edit->Preferences (Adobe should know by now that Windows programs do not have Preference in the Edit menu. That is legacy Mac OS 9 behavior. Please fix this).
  3. Click on Internet
  4. Uncheck Display PDF in browser
  5. Unhceck Allow fast web view

Now quit Acrobat. Problem solved. However, in my attempt to semi automate this I tried to figure out what regkeys control this behavior and failed. It seems that the following regkey controls the browser setting:

[HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\6.0\Originals]
"bBrowserIntegration"=dword:00000000

However, if you set this it does not actually work until you launch Acrobat and go to Preference and Save them. seems changing the regkey in and of itself does nothing till the prefs somehow get marked dirty. Does anyone have an secrets about making this stick?

While we are on the subject, launching Acrobat is painfully slow. In fact, for a product that is designed to be used to read documents it doesn't really optimize for that scenario (it's very slow, page flipping is slow, and launching is slow). There are some documented ways to speed up Acrobat by quite a bit though. But common, I really shouldn't have to do this. Don't load plugins and code that I'm not ever going to use. Go look at how fast Word, PowerPoint and Excel boot.

I'm also assuming there is good reason why Apple has written their own PDF viewer that ships with the OS. It's far superios to Acrobat Reader for doing the most common scenerio (reading a PDF).

Posted Thursday, April 29, 2004    Permalink    Comments [3]  View blog reactions

 

Office Documents opening in IE

One of my biggest gripes about Windows and Office is that when you click on a word, excel, or PowerPoint doc (or acrobat doc) in Internet Explorer, those documents render in the browser pane. This is one of the biggest usability issues I face with Windows. Since you don't get the Application menus and so on it makes it very difficult to work with the document if you wanted to edit it (which is what I usually do). And if you do edit it, you are presented with a horrible dialog when you try and navigate away (and there is no easy way to do a File->Save As). Further I much prefer to view a PowerPoint slide deck in PowerPoint than use that wacky web way of navigating the slides. Finally, if you are a portable user, not having the document open in the respective Office application make it hard to manage offline.

Gus Perez documents how to fix this. But since I frequently “repave” my Windows boxes and use multiple computers I am loathe to do anything manually. So to save you the time here are the necessary registry settings to make IE behave the way that I expect it to. Save the text below into a notepad file and call it OpenOfficeDocsInOffice.reg and then double click that file. Save it in a place you can access and open it on every machine you use.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Word.Document.8]
@="Microsoft Word Document"
"EditFlags"=dword:00010000
"BrowserFlags"=dword:00000008

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.8]
@="Microsoft Excel Worksheet"
"EditFlags"=dword:00010000
"BrowserFlags"=dword:00000008

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\PowerPoint.Show.8]
@="Microsoft PowerPoint Presentation"
"EditFlags"=dword:00010000
"BrowserFlags"=dword:00000008

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Visio.Drawing.6]
@="Microsoft Visio Drawing"
"EditFlags"=dword:00010000
"BrowserFlags"=dword:00000008

 

Posted Thursday, April 29, 2004    Permalink    Comments [5]  View blog reactions

 

# Wednesday, April 28, 2004

iTunes 4.5

iTunes 4.5 is out. Most interesting new features:

  1. Can import WMA files
  2. New format, Apple Lossless

Welcome to the party. I rip all my audio as WMA Lossless cause I don't want no stinkin compression. However, I trancode all my audio to the latest and greatest audio format.

The fact that it can now import WMA is great cause I'll be able to just point it at my WMA collection and suck it in to my iPod.

I really hope they made it so that the iPod batter meter actually does something useful. Right now it's completely worthless. If I charge my iPod all day long and un plug it, the things starts off as half empty. Sheesh, it's almost as bad as the gas gage in my Audi.

Posted Wednesday, April 28, 2004    Permalink    Comments [3]  View blog reactions

 

When COM Registration fails in an MSI (vsdraCOM has no affect)

 Summary

In this weeks’ installment of I hate COM, lets talk about a frustrating problem I’ve been having (turns out I had this problem when I wrote my Media Center Front Panel Display but found a different workaround I mention below). It would be nice if there were a KB article on this topic, but there isn’t and I don’t know why.

Say you are exposing a .NET component as a COM component. Not to uncommon. I already do this in my Outlook2OneNote add-in as well as my Media Center Front Panel Display. In both these cases I am implementing a COM Interface: Extensibility.IDTExtensibility2 for Outlook2OneNote and EHLib.IMediaStatusSink for my Media Center Sink.

In Outlook2OneNote the project structure looks like

  1. Project 1 – contains the guid and COM Inteface
  2. Project 2 – inherits from a class in Project 1 and is marked for COM registration
  3. Setup – Primary Output from Project 2’s Register value is vsdraCOM

In MediaCenterSink the project structure looks like

  1. Project 1 – contains the guid and COM Inteface and marked for COM registration
  2. Project 2 – contains the code for the Sink
  3. Setup – Primary Output from Project 1’s Register value is vsdraCOM

In both cases the MSI does not register the Primary Output for COM Interop. It’s not obvious why this fails, but I spent many hours trying various things (you know how trial and error is when you don’t have an understanding for what is going on or what is broken right?). So you can imagine how frustrating this is. Even more frustrating is when this happens to you twice in the course of a few months.

Approach 1: Custom Action

Well, google had no answers for me except a bunch of other people who were saying “COM Registration during install using MSI is broken…” or “vsdraCOM doesn’t do anything…” etc. The only solution that I found was to write some code in the Primary Output project like so (you need a similar Uninstall and Rollback override as well):

public override void Install(System.Collections.IDictionary stateSaver)
{
    base.Install(stateSaver);

    try
    {
        RegistrationServices regSrv;

        // Register the assembly
        regSrv = new System.Runtime.InteropServices.RegistrationServices();

        if (!regSrv.RegisterAssembly(
            this.GetType().Assembly, AssemblyRegistrationFlags.SetCodeBase))
        {
            throw new InstallException("Failed to register componenet for COM interop");
        }
    }
    catch
    {

    }
}

And then create a Custom Action in your MSI that points to the Primary Output for Install, Uninstall and Rollback. This actually works pretty well, and I was happy with it.

Well when this problem happened for the second time just this week when I switched my Outlook2OneNote project structure from being a simple Project that had all the logic to one that inherited from another class in another project I started wondering and thinking this has to be a bug. Well using my super hero powers I tracked this problem down and found a better work around.

Additionally, I've been told that custom actions should be avoided for a number of reasons. One good reason is that if you ever use the MSI in the future to upgrade your assembly, it will fail.

Approach 2: Simple workaround for bug

Rather than adding the Primary Output of the project that needs to be registered for COM Interop, do the following:

  1. In your setup project remove the Primary output from <Project Name>.
  2. Select your setup project, right click, select Add->Assembly
  3. Navigate to the bin/Release directory of your Primary project and select your dll
  4. Select the Assembly in the setup project and set the Register value to vsdraCOM

Summary

By adding your assembly directly to the MSI and not relying on the Custom Action workaround mentioned above, you can rely on the MSI to register your component for COM Interop.

BTW – IMHO, developing .NET components and exposing them as COM components is a nasty business and one that I NO LONGER ENJOY!!! I am writing this because it’s a bit therapeutic and I hope it helps someone else who is having this problem (rather than hurl my laptop against the wall).

update: I made some corrections to this post based on some feedback from Rob Mensching.

Posted Wednesday, April 28, 2004    Permalink    Comments [10]  View blog reactions

 

# Monday, April 26, 2004

Send to OneNote from Outlook PowerToy

At long last, my PowerToy is live! Send to OneNote from Outlook lets you send Mail, Post items and Sticky Notes to OneNote (note, this was previously called Outlook2OneNote).

While you are there I also recommend Send to OneNote from Internet Explorer.

Both of these use the OneNoteImporter that Donovan created.

A lot of folks at Microsoft were instrumental in dogfooding the product as well as answering my never ending questions about managed programmability in Office 2003. Special thanks to Siew Moi Khor and Misha Shneerson for showing me the light.

Note, if you install this PowerToy and you do not see the toolbar icons in your Outlook standard toolbar this is because the Outlook 2003 .NET Programmability Support is not enabled. To fix this you must:

  1. Uninstall the PowerToy if you have already installed it
  2. From the Start menu, select Control Panel, and click Add/Remove programs.
  3. Select Microsoft Office Professional Edition 2003, and then select Change.
  4. Select Add or Remove Features and click Next.
  5. Click Chose advanced customization of applications.
  6. Expand Microsoft Office Outlook, and confirm .NET Programmability Support is set to Run from My Computer.

Posted Tuesday, April 27, 2004    Permalink    Comments [13]  View blog reactions