shahine.com/omar/

homepage | Send mail to the author(s) contact

yet another Microsoft blogger

# Tuesday, April 13, 2004

NewsGator for Media Center

I've been using this for a few weeks and it's dammed cool. Check your RSS feeds while being a couch potato using Windows Media Center 2004. It even streams videos from feeds such as Channel 9.

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

 

# Thursday, April 08, 2004

Bedlam

When I joined Microsoft this story was already very famous. There have been a few instances since then where people would reply to mysterious DLs saying take me off this and then the flury of replies. However, someone who has been here long enough usually says “remember bedlam”.

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

 

# Wednesday, April 07, 2004

Caltrain Express Service starts June 7th

In what has to be some of the most exciting news for my commute, Caltrain is set to launch it's Baby Bullet Express service which will get me from San Francisco to Mountain View in 45 minutes (currently it takes anywhere from 69-78 minutes). Right now, I can currently drive from SF to MV in about 45 minutes which makes the current commute time on the train less than appealing.

The big day is June 7th.

Posted Wednesday, April 07, 2004    Permalink    Comments [0]  View blog reactions

 

# Sunday, April 04, 2004

Entourage: A journey to becoming an Office application

It’s not often that a new Office application is born. That’s especially true on the Mac. This is a story about Entourage, a product that was called Alpaca for the longest time.

I joined Microsoft in January 1999. At the time, the team I joined was publicly working on Outlook Express 4, 5 and secretly building a Personal Information Manager for Mac Office. When we started the project we shared very little to no Office code. Over a 2 year period we morphed into a product that shipped in the Office box. The first thing I got to do when I joined was basically run the Outlook Express 5 project. I was 22 years old. Can you imagine showing up at a Company and being given responsibility like this? It was just unbelievably exciting (coincidentally, my soon to be roommate, Jimmy Grewal, was given similar responsibility on Internet Explorer). Two 22 year old punks who never shipped anything in their lives shipping what became the most popular browser and mail client on the Macintosh. I remember going over to Apple for meetings some times and they would be like, are you kidding? Where are your parents?

Outlook Express was actually a new name for a product that was called Internet Mail & News. No offense to the people who worked on this, but compared to the competition, IMN was a crappy mail product. Microsoft hired a lot of people from Claris and Apple who helped take the IMN code and build OE. Development and features were added at warp speed. However, the group building Outlook Express and IE were folded into the MacBU about 6 months before I joined. At that point OE was viewed as a product that would grow to become the PIM for Mac Office. Since Windows Office had Outlook, we needed something similar on the Mac. At the time there wasn’t a viable product that offered all the functionality of Outlook in a single application. So when I joined we were all really working on Entourage 2001. At the time, we managed to convince upper management (mainly Ben Waldman, our General Manager and Kevin Browne, our Lead Product Planner and soon to be General Manager) that we needed to do another release of OE to stay competitive and compliment IE 5. It really wasn’t until MacBU took on our group that OE was given any attention. Before that, IE was the sexy product and the one that got most of the attention and resources. Office changed all that.

I remember sitting in a room with a bunch of people and trying to convince Ben Waldman that OE 5 was a good idea (this ultimately meant sucking resources away from Office, the big money maker, for a free product). Somehow we were successful, but I remember being scared to death. So the OE 5 project was born and I got to pick the code name [update: corrected mistake per this post from my first manager]. We called it Newman, after the mail delivery man on Seinfeld. He was famous for saying “When you deliver the mail, you control Information”. The code name for Entourage was harder to select. We had some bad ones, but finally, Jud Spencer settled on Alpaca. If you have ever flown Alaska Airlines you’ll note the Alpaca ads that they have in there. “Alpacas, the huggable investment”. If you watch CNN late at night you’ll also see the commercials. Alpaca would remain the code name and the actual product name till months before RTM… finding a name that no one else was using was next to impossible (remember, dotCom days).

Anyway, OE & Entourage were native Mac applications (no ported code, and no Office code), and we didn’t really follow the methodologies that the rest of Office followed. Entourage, OE and IE were developed in North San Jose, while the rest of MacBU was in Redmond (PowerPoint was in Cupertino). None of us had any exposure to the long established processes of the rest of the business unit, and we all got a crash course.

In addition to being a kick ass mail product we also had to build a calendar, contacts, tasks and notes interface, support internet RFCs like iCal, vCard, and create a data store for all this data. We also had to interoperate with numerous different products (wire protocols, authentication, meeting requests, e-mail formatting etc). On top of that we had to have some features that leveraged the fact that we were an Office suite, and of course we had to “Look and Feel” like an Office application.

That final sentence was the source of so much contention, especially for me. Remember, we were a native Macintosh application. Office still had a lot of legacy code, non native Mac UI, and other things. So “Look and Feel” like an Office application sometimes meant look and feel less like a Macintosh application. Let me give you some examples.

Icons

In Outlook Express 5 we wanted to have a fresh and pretty look and feel. I went out and hired the Icon Factory to design about 120 icons from scratch. These were 256 color icons, a big deal in that day. The Icon Factory OE 5 page states: “The goal of the project was to give the entire OE icon suite a cleaner, more "mac-like" look and feel.” By comparison Mac Office and Win Office were limited to 16 colors. And they were the most saturated and ugly 16 colors on the planet. We were “told” that we would have to take our beautiful 256 color icons and make them only 16 colors. Ack! That was battle number one. I tried to convince Office to move their toolbars to 256 colors but it was deemed too expensive. Ack! I panicked. In the end we managed to change the 16 colors to a more muted and pleasant 16 colors, redid most of the Mac Office icons in these new 16 colors and updated the Entourage icons to use the same palate but we could keep our 256 colors.

Preferences

Mac program had their preferences menu in the Edit menu. Office programs have their Preferences menu in the Tools menu. Guess where OE and Entourage had theirs? One of my favorite accomplishments was getting all the rest of Office to do things like a proper Mac application ;-).

Toolbars

Outlook Express and Entourage had docked toolbars while Word, Excel, PowerPoint had global toolbars. Our toolbars were contextual (they changed depending on where you were in the application) where the others were always global and static. We were told to change our toolbar to be more like Office. Well, that was another long battle that we thankfully compromised on by promising to at least make our toolbars look like Office. However, since we didn’t’ share any code with Office we had to write our own implementation. For Office X we ended up throwing this all away when our new Toolbar implementation for Office (to support 32 bit icons) was done.

Spell Checking, Autocorrect etc.

There are many features that are just expected of an Office application. Two of those are spell checking and autocorrect. These were enormously complex things to do. Our application was built on a Macintosh development framework called PowerPlant. Meanwhile Office had its own custom framework and a lot of work was done on both sides to factor our applications such that we could use Office components without the massive overhead of supporting the office framework in its entirety. This was really hard stuff to get right, but when we did it was just so cool to have the red squiggly. We never did grammar checking.

Shared Features

There were lots of ideas for shared features. Some of them never saw the light of day, and others took a very long time to get right. One of these was the Word/Entourage integration. The idea being that you can access the Entourage address book from Word for composing letters, inserting contacts and customizing Word templates based on your personal information (we created the notion of a “Me” contact in Entourage, that allowed us to do some cool things like auto fill personal information in Word templates, or get driving directions to and from people’s work and home addresses via Expedia). This work required a lot of collaboration between to teams that sat many miles away and didn’t always see eye to eye. In the end the feature worked, and worked well, but it was another one of those amazing learning experiences. There were many more of these shared features. They all required extensive work on both ends. We were really building the bridges between Entourage and the rest of Office that would then be used for many years to deliver much more advanced and user centric features that really leverage the entire Office suite (Project Center in Office 2004 is a good example).

Anyway, our team learned a lot in becoming not just an Office app, but in becoming a team and an integral part of the success of the suite. For the next project, Office X, Entourage was the first application to get Carbonized. Because we didn’t share much code with Office, and because we were the youngest code base it only took a few months to get us running on X. It took many more months to make our Look and Feel stunning on OS X and the good news was that the rest of Office really had to purge a lot of the old crust to get to X. Since X was all about a new Look and Feel called Aqua, this was a boon for us, and it meant that all of Office got 32 bit icons. A far cry from the 256 colors in 2001! We also got more and more Office functionality as a result and that was great. Entourage really started to become the hub of Office, and that is so very true in this year’s release.

Posted Monday, April 05, 2004    Permalink    Comments [15]  View blog reactions

 

# Friday, April 02, 2004

System.Drawing.Image Performance Update

Update: I've been informed that using the method below can have significant consequences in the future. Using private reflection isn't a good idea because the private methods can change in the future and this code WILL BREAK. Be forewarned.

Well, thanks to Justin Rogers you can have lightning fast loading of Jpeg images w/o having to wait for a Service Pack or get a hotfix from Microsoft as I recently blogged about.

I tested his code and found no difference in speed between the method I was using and his method. Since using his method will work on .NET Framework 1.1 it's the preferred solution. You still need permission to run Unmanaged Code.

One way to handle the need for Unmanaged permission is to add this attribute to the function and then add a try/catch and use the regular method in the catch:

[SecurityPermission(SecurityAction.Demand, 
Flags = SecurityPermissionFlag.UnmanagedCode)] public static Image FastFromFile(string filename) { try { filename = Path.GetFullPath(filename); IntPtr loadingImage = IntPtr.Zero; if (GdipLoadImageFromFile(filename, out loadingImage) != 0 ) { throw new Exception("GDI+ threw a status error code."); } return (Bitmap) imageType.InvokeMember("FromGDIplus",
BindingFlags.NonPublic |
BindingFlags.Static |
BindingFlags.InvokeMethod,
null,
null,
new object[] { loadingImage }); } catch (SecurityException) { return Image.FromFile(filename, true); } }

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

 

Laptop gripes

Dennis just wrote about some laptop frustrations. I have to agree. I can't tell you how many times I've closed my laptop lid, placed it in my bag and opened it back up on the train a 30 minutes later to find the battery half drained. Since I refuse to install any of the Toshiba Power management software for my Tablet PC (because it locks it up from time to time) I get about 1.2 hours of juice as my tablet runs at full bore the whole time.

Today I flew up to Redmond and for the first time in my life forgot my power brick. What a disaster. This made me wonder why the world needs 25 different kinds of power tips and adapters. Can't the manufacturers just agree on one common plug and then design DC adapters that aren't ugly and huge but smart and small, include cable management and can dynamically adapt to charge any laptop? Then I could just borrow one from anyone with a laptop.

Apple has always made superior laptops. They just work, aren't ugly with dozens of panels, protruding pieces of plastic and boneheaded design placement like my microphone that is located right near my loud fan. Oh, and lets not even mention the 15 or so “stickers that come on the thing. That's just tacky. I'm not sure this will ever change. The business that OEMs are in require that they compete on price, so they'll never spend the kind of money Apple does to make their stuff sexy and functional. If you don't know what I'm talking about, go to an Apple store and play with a 15 or 12 inch PowerBook. Notice the clean design, smart placement of panels, lack of stickers and panels, fluid lines, pulsing LED lights, keyboard controls that have stunning On Screen UI, and ambient light detection for back lighting the keyboard etc.

Posted Friday, April 02, 2004    Permalink    Comments [2]  View blog reactions

 

# Monday, March 29, 2004

System.Drawing.Image Performance

As I mentioned earlier, I wrote an application called JPEG Hammer for manipulating and viewing EXIF data in digital photos. As a .NET Application the single biggest performance bottleneck has been:

Image photo = Image.FromFile(fileName, true);

For a 6.1 megapixel (3008 x 2000) 1.47 MB JPEG it took on the order of 631 milliseconds to load. Multiply this by 50 or so photos and you are talking about 32 seconds to fully load these pictures. Then add the time necessary to draw the UI for the app, update thumbnails etc. On a 1.8 ghz Pentium 4 I'd expect more... and lets just say it's no where near as fast as the XP Shell (or other non .NET phot apps), so what gives?

Well, after much Googling (with no success) I tried http://support.microsoft.com/ and I came across this gem (Microsoft KB 831419):

FIX: Slow performance when you call System.Drawing.Image.FromStream to load a bitmap image

So, curious as I am, I get my hands on this hotfix which updates:

  • System.Windows.Forms.dll
  • System.Design.dll
  • System.Drawing.dll

Specifically, this update adds a new method to System.Drawing.Imaging:

System.Drawing.Image.FromStream(Stream stream, bool useICM, bool validateImageData)

This is essentially a new signature for an existing method:

System.Drawing.Image.FromStream(Stream stream, bool useICM)

As you can see, validateImageData is a new parameter. Setting it to true is the default behavior that we have today (essentially the same as calling FromStream(Stream stream, bool useICM)).

So I made a change to my application. Before my code looked like this:

using (Image photo = Image.FromFile(this.fileInfo.FullName, true))
{
    //do stuff
}

So I changed it to:

using (FileStream fs = new FileStream(this.fileInfo.FullName, FileMode.Open, FileAccess.ReadWrite))
{
    using (Image photo = Image.FromStream(fs, true, false))
    {
        // do stuff
    }
}

And here are the results. The average time it took to process 37 JPEGs taken from the same camera and roughly the same size went from 631ms to 6.76ms. So, this new method is 93x faster. Holy Cow!!! I thought that maybe something was wrong, so I re-ran the tests many times, and always got the same result. Simply mind boggling. This probably brings the .NET implementation to the same speed as writing native C++ code against GDI+.

The good news is that the article mentions that this fix will get rolled into the next Service Pack. However, you'll need to modify your code as I did to take advantage of this.

Update: you can download this fix in SP1 of the .NET Framework 1.1:

http://www.microsoft.com/downloads/details.aspx?FamilyID=a8f5654f-088e-40b2-bbdb-a83353618b38&DisplayLang=en

Posted Monday, March 29, 2004    Permalink    Comments [6]  View blog reactions

 

# Sunday, March 28, 2004

dasBlog log relief coming soon

For those of you that are finding your log directories are > 100 MB you’ll be happy to see the screenshot below. Each time a new log file get created, a process is queued to archive the previous day’s log file.

Posted Sunday, March 28, 2004    Permalink    Comments [3]  View blog reactions

 

San Francisco's got problems

As if this was a shocker, SFgate has an article on the city payroll.

San Francisco General Hospital police Sgt. Eric Cranston, who earned a $63,715 base salary last year, added $126,644 by working 2,556 extra hours. Anene Ugbaja, a security officer at the hospital earning a $56,979 base, worked 2,930 overtime hours for $122,126 in time-and-a-half pay.

I find this unbelievable. Why? Cause my wife is a Resident and employed by the State of California and the City of San Francisco. She gets paid a ridiculously low salary (far far less than the security officer's base pay) and works on average 80 hours a week. In fact, the federal government had to step in and mandate that any hospital that has residents working greater than an average of 80 hours per week would be in violation (yes that means she can work 90 hours one week, 70 the next, etc and still pass). So, she doesn't get overtime pay even though the city pays her based on an hourly rate of 40 hours per week (M-F 9-5). So, every hour that she is required by her program to work she is effectively not getting paid.

Oh, and did I mention, she works in a profession where the life of a patient is in her care? I really don't understand how a society that values the lives of it's individuals so much can afford to treat residents like this. Meanwhile, the security officer at SF general is earning quite a nice living on my dime.

I could go on about how Residents in this country are screwed each and every day. Not only are they usually carrying about $200,000 in debt, they typically can't pay off that debt till after their 3-6 year residencies where they get paid less than most any other municipal employee (and way less than nurses). They are essentially carrying this royally screwed up health care system forward and paying for the millions of uninsured Americans (the burden almost always falls on them).

Posted Sunday, March 28, 2004    Permalink    Comments [7]  View blog reactions

 

# Saturday, March 27, 2004

Loving the D70

Here are some of my first snapshots with my new D70. These are all taken of a fire hydrant down the street. One of the things I love to take pictures of are man made objects that are victims of nature. 

I absolutely love this camera. It's been many years since I owned a Nikon SLR. My first ever camera was a Nikon 2020 that I got in the 4th grade (which is when my love for photography began). I shot mostly Black & White and developed it myself till about college. I later got a Nikon N55 which was a nice improvement on the 2020. Nikon has added a ton more features to SLRs since then and I have a lot to learn. Most of the basic controls are the same but there are some super nifty features like predictive auto focus, depth of field preview, etc. Having a digital SLR is actually quite an experience since you get the benefits of looking through a quality lens, instant gratification from preview allowing you to really perfect the shot. I also happen to love the Instant On and quick response of this camera.

D70 first pictures

D70 first pictures

D70 first pictures

Posted Sunday, March 28, 2004    Permalink    Comments [1]  View blog reactions

 

# Friday, March 26, 2004

JPEG Hammer & PhotoLibrary progress

A long time ago, I started a little project to do a simple thing: Automatically rotate Jpeg images based on the EXIF orientation tag that some cameras embed. I also wanted an easy way to adjust the Date & Time of my photos based on a timezone offset. The scenario being: you get on a plane to go somewhere, take a bunch of pictures but forget to change the Date & Time on your camera. Well this fixes that. Then I started to mess around with EXIF information and decided that I wanted to build a Class that essentially wrapped all the EXIF 2.2 tags into a nice object.

Well I think I am ready for a preview release. I created a GDN workspace for the project a while back but I’ve been too busy to finish everything up. In the next few days (maybe this weekend) I’ll make available a preview of JPEG Hammer and PhotoLibrary. I’d love to get some feedback from people on what PhotoLibrary is missing or what could be different. This is the first time I’ve ever designed a class to be re-usable by other folks (I plan on using it in dasBlog for my pending PhotoAlbum feature which is taking me forever to complete).

You can see a list of all Properties, Members of the Photo Class.

Posted Saturday, March 27, 2004    Permalink    Comments [3]  View blog reactions

 

Clean Project

Does anyone know why there is a Clean button in the Batch Build dialog in VS.NET but it fails to do anything? I think this would be a useful feature no? (delete all the files in bin/Debug and bin/Ship). If you rename your assemblies a lot of crud builds up there over time. It would also be nice for zipping source to send to some one (no need to send the output in the /bin and /obj directories).

Maybe it’s fixed in Whidbey?

MSDN Search yielded no useful information.

Posted Friday, March 26, 2004    Permalink    Comments [5]  View blog reactions

 

is keyword

I don't know how I missed the is keyword in C#. I must have been asleep or something when I read about this. Up till now I've been getting the type of an object and comparing to the typeof() a class.

object foo = "bar";

if (foo is string)
{
    Console.WriteLine("foo is a string");
}

if (foo.GetType() == typeof(string))
{
    Console.WriteLine("foo is a string");
}

Posted Friday, March 26, 2004    Permalink    Comments [3]  View blog reactions

 

Gyration Wireless Keyboard and Mouse

For a few months now I've been happily using a Gyration Wireless Keyboard and Mouse for my Windows Media Center. I've been extremely happy with this combo. The mouse can be used without needing a table or surface (you just wave it in the air). It takes a while to get used to this, but once you do then you are free to walk around etc while you control the mouse. The mouse comes with a charging station and also has an optical sensor so that I can be used as a regular mouse.

They keyboard is very small, and is running on it's original set of batteries. It's perfect for MCE as I can easily hide it. Another bonus is that the keyboard requires no drivers and works on the BIOS screen in case you need to make any tweaks etc.

A few weeks ago, my mouse flaked out though. On Monday I finally got around to calling them. The support experience was fantastic. I got a human on the first ring and he told me to send it back to them (no need to find my receipt or anything). Today I got my replacement (total of 4 day turnaround). Now that's great service!

Posted Friday, March 26, 2004    Permalink    Comments [0]  View blog reactions

 

# Thursday, March 25, 2004

BlogJet

For the past few days I've been trying to get BlogJet working with dasBlog. Lets see if it works.

Posted Thursday, March 25, 2004    Permalink    Comments [0]  View blog reactions