Archives for Amy Marker

Google Rss Reader is very cool

I have recently switched my RSS aggregator to Google Reader. This app is still officially in the Google Labs environment, so once in a while there will be a slight hiccup. But, overall I have found this to be a great rss reader.

It has full keyboard support!

  • J to move down article list
  • K to move up article list
  • SPACE to page through a long post, then when the end is reached it moves to the next unread item in your list

It also has support for tags or categories, or labels as Google calls them, which comes in handy if you want to categorize your feeds. You can also share your “starred” items, this feature I have not checked out yet, but it seems interesting.

If you go to the familiar Google search box at the top, it allows you to search for new blogs on a topic. For example, go to the search box at the top, enter “Rob Herbst”, then hit the button labeled “Search for new content”. Now click on the subscribe button….only kidding.

Google Reader also supports mobile devices, which is great if you have to catch up on your feeds on the go.

This post on the Google Reader Blog reviews a sample of what the top errors in the xml feeds that the development team sees. Pretty interesting to see the number two is mismatched tags!

Overall, I think this is a great rss reader that is definitely worth checking out.

Update 8/11:

My friends Pete and Nick don’t like Google Reader. I guess it all comes down to your personal workflow. I used to read my blogs in a similar fashion but that just didn’t work for me. I realized that I had subscribed to way too many blogs, and there was no way I was ever going to have time to read them all. I’m glad that method works for Pete & Nick.

Actually, looking at all those unread items in my Newsgator/Outlook newsreader made me feel like I wasn’t able to keep up — very unmotivating for me. So what I did was to radically trim down the number of feeds that I read. It was difficult to do, but I tried to look at each one and really determine if I was really getting any value from it.

I was able to cut my subscribed list down to just a handful, so the approach that Google Reader takes works perfectly fine for me. I only get about 15-20 new posts per day, so cruising through them in the one place is okay with me. I guess, it also resonates with my Getting Things Done experience. With this approach I have an inbox, where I process the items one at a time. I understand that if you have a much larger & varied subscription list this approach doesn’t seem to work well.

As for keeping entries for future reference, you can either “star” them, or inside the view when you are reading the item, you can check the “keep unread” and it will be displayed until you manually clear it.

I do have to say I was on the train today and I was very happy being able to read my blog entries on my smartphone (which is true of any server based aggregator). That was very cool!

Anyway, Pete & Nick, I’m sorry you guys don’t like Google Reader, but like I mentioned at the top I think it all comes down to personal workflow in how you read your feeds. Both of you seem to have a similar approach were a tool like BlogLines or Newsgator is a better fit.

Running Fedora Core 6 On Microsoft’s Virtual PC 2007

I was able to get Fedora Core 6 running very well on Microsoft’s Virtual PC 2007 with just two small tweeks. The main problem is the emulated S3 video card doesn’t support 24 bpp mode, whereas the actual hardware card does! I wish I could find the blog or newsgroup post that I found that originally pointed this out so I could give credit to whoever figured this out — thanks! If you know please contact me and I’ll update the blog post.

Here’s all that i had to do:

  1. Run the install in text mode. You do this by entering “linux text” without the quotes at the initial prompt.
  2. When Fedora boots:
  • Login
  • vi /etc/X11/xorg.conf
  • In normal mode: type /DefaultDepth — which if you are not familiar with vi, just means search for the string “DefaultDepth”
  • Change 24 to 16
  • :wq to save and exit vi
  • Enter “startx” without the quotes at the terminal to start X.
    That’s all you should need to do!

Fun With GC.SuppressFinalize

I was able to get Fedora Core 6 running very well on Microsoft’s Virtual PC 2007 with just two small tweeks. The main problem is the emulated S3 video card doesn’t support 24 bpp mode, whereas the actual hardware card does! I wish I could find the blog or newsgroup post that I found that originally pointed this out so I could give credit to whoever figured this out — thanks! If you know please contact me and I’ll update the blog post.

Here’s all that i had to do:

Run the install in text mode. You do this by entering “linux text” without the quotes at the initial prompt.
When Fedora boots:
Login
vi /etc/X11/xorg.confWhile discussing some code with a colleague, I ran across an unexpected behavior of GC.SuppressFinalize. I’ve put together a small sample for our discussion.

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
public class Base
{
~Base()
{
Console.WriteLine(“Base Finalizer called”);
}
}

public class Derived : Base
{
~Derived()
{
Console.WriteLine(“Derived Finalizer called”);
}

public void Suppress()
{
GC.SuppressFinalize(this);
}

}

class Program
{
static void Main(string[] args)
{
Derived d = new Derived();
d.Suppress();

Console.ReadLine();
}
}
}
Okay, so what gets printed out at the console?

Actually, nothing.

It was a little surprising to me at first, especially since after years of C++ programming the ~ immediately invokes destructor semantics in my head. I worked through a number of different variations, but I always got the same result. I used the !FinalizeQueue command available in the SOS extension of WinDBG to verify that there was only the Derived class reference on the queue. So when you say, SuppressFinalize(this) you really mean it!

Now, granted, this is a cheesy example. But the discussion came up when talking about the correct way to implement IDisposable. In the example provided, SuppressFinalize(this) is called in the Dispose method. Now that’s a good thing, because you want to prevent the call to the finalizer since you have already cleaned up any resources via your Dispose implementation. But, what happens if a class you derived from, either your own or a third party, does not implement IDisposable and instead is relying on the finalizer? Or they do implement IDisposable but somewhere else along the virtual method override chain someone forgot to call the base class implementation.

This really never should be a problem if your code implements the IDisposable interface correctly. And since implementing a Finalizer on your class has a negative performance impact you should only use them when you really need to. Anyway, this makes a great conversation at any nerd party

Visual Studio Keyboard Tip #7 – Incremental Search

The Visual Studio editor has a very useful incremental search feature built in. Let’s try it out.

  • Create a new Windows Application project.
  • Open up the Form1.Designer.cs file in the editor.
  • CTRL + I (this activates Incremental search mode)
  • Type: “disp” (without the quotes)
  • The selection should have moved to the first match of “disp” in the file.
  • Type CTRL + I again. This moves you to the next match.
  • CTRL + SHIFT + I moves you to the previous match.
  • BACKSPACE removes the last character from the search string.
  • ESC cancels incremental search mode.

My Addition to the “Top 10 Ways to Motivate Geeks” List

Here’s my addition to the lists started on the Retrospector blog and commented on by Michael Affronti and Steve Clayton:

Geeks like to be challenged with really interesting problems.

Most geeks, myself included, want to be challenged with really interesting problems to solve. The kind of problems that are only limited by your own creativity and determination to come up with the most simple, elegant and effective solution.

Do you have any more you would add to the list?

C# WeakReference Example

How would you like to be able to write the programming equivalent of “I might need this later….but I’m not so sure”? I’ll show you how.

A WeakReference is an object with a very interesting behavior, it allows you to keep a reference to an object while still making it possible for it to be garbage collected. See a previous post for a little more detail and links. Internally the WeakReference type uses an IntPtr to track a GCHandle that was acquired using the GCHandleType of Weak or WeakTrackResurrection.

This can be very useful if you are trying to managing the lifetime of objects in a cache or adding optimizations to possibly save time by not having to recreate an expensive object.

Let’s look at an example.

In your class you created two member variables:

WeakReference _weakRef = null;

Person _strongRef = null;

You created two new Person objects (which are simple objects I just created for this example, consisting of a Name property and some reference tracking code). Next you set the member variables to the newly created instances of the Person objects.

_strongRef = p;

_weakRef = new WeakReference(p1);

The difference here you’ll notice that _strongRef is just a regular normal reference, whereas _weakRef is set to a WeakReference object with the person object (p1) passed in as a parameter in the constructor.

If a garbage collection were to occur, or just for testing purposes you called it yourself with:

GC.Collect();

Then the p1 target object that is held by the _weakRef member variable should be garbage collected. You can write code to check:

if (_weakRef.IsAlive)

If the WeakReference is still alive you can convert the WeakReference to a strong or normal reference by using code like this:

Person p = _weakRef.Target as Person;

Now the p reference is treated as a strong reference and won’t be collected until it is no longer used. If you wanted to keep the reference around after the scope you could set that to a member variable.

There aren’t many times in programming that you get to say “maybe”. It’s usually binary — 1 or 0. A WeakReference seems to be one of them.

 

10 Cool Features Of The Google Search Box

Here is my entry for the latest Problogger Group Writing Project. If you would like to participate too, you can submit your entry before the end of the day Thursday August 17th.

I wanted to write about something that I thought would be very useful to anyone who uses the web. The search box on Google has some neat features in addition to searching. Here are my favorites:

  1. Calculator – performs math and conversions
    1. 5 miles in km
    2. 2 ^ 6
    3. 34 * 97
  2. URL Information – find out what sites link to a url
    1. www.problogger.net
  3. Definitions – provides the definition of the word entered
    1. define Blog
  4. Phone Number Lookup – you can look up residential and business phone numbers
    1. starbucks new york
  5. Answers – you can enter in fact based questions and Google returns the answers
    1. population of united states
    2. birthplace of bill gates
  6. Site specific searches – if you enter a site:url then your search results are restricted to just that site
    1. list site:problogger.net
  7. Stock quotes – enter a ticker and get a stock quote including a chart
    1. goog
  8. Weather
    1. weather san jose, ca
  9. Map Info
    1. 1 infinite loop, cupertino, ca
  10. Movies – display movie information for a given location or zip code
    1. movies 98104

Really Powerful Debugging With WinDBG & SOS.dll

If you have never used WinDBG or the SOS extensions before, read the following blog posts by Mike Taulty:

  • A word for WinDBG – Part 1
  • A word for WinDBG – Part 2

Mike walks you through a sample debugging session with WinDBG. Then in the second part, he focuses on the SOS extensions for .NET debugging. With the SOS extension you can do some seriously cool stuff:

  • View thread/threadpool info
  • View the finalizequeue
  • See what’s allocated on the managed heap
  • Determine what is keeping your managed object from being finalized by viewing it’s “roots”

If you have Visual C++ installed you can actually use SOS calls from the Visual Studio debugger! Read Mike’s post, that walks you through the setup and use of SOS from inside Visual Studio. As Mike points out, make sure you go to the project properties, choose Debug, and then check “Enabled unmanaged code debugging”. Be prepared the very first time you do this, it might be slow because the symbols have to be downloaded/loaded.

Visual Studio Keyboard Tip #6 – Find Window Command Line

There’s a great feature hidden in the Find Window Combo Box that is part of the standard Toolbar in Visual Studio.

  1. Open Visual Studio
  2. CTRL + N (Create a new file) choose “HTML Page”
  3. Position the cursor on the tag
  4. Press CTRL + /
  5. The focus should have shifted to the Find Combo Box
  6. Type >
  7. Now type E
  8. Cool! It’s a command line with built in Intellisense.
  9. Type dit.LineT
  10. The entry for Edit.LineTranspose should be selected
  11. Press enter

You’ll notice that the and tags are now transposed. Take a few minutes to look around at what commands are available in this list. You can browse the list by entering one letter at a time. For example “>a” to see all the items that begin with a.
This is a great way to quickly execute commands that aren’t mapped to convenient keyboard shortcuts.