Navigation
Links

Powered by Squarespace
Monday
Feb262007

Heroes

Just saw the latest episode of Heroes: The Company Man:

Not only is this best episode of Heroes yet, it’s officially the best TV show, ever. Watch the full series premiere for free, or, get the entire season pass on iTunes.
Tuesday
Nov212006

Removing a control’s behavior

In Programming .NET Components, Juval Löwy explains the reasoning behind and how to use the EventHandlerList class (It’s used internally in the Control & derived classes to store event subscriptions).

I found that this architecture easily supports the removal of all behavior*:
public static void ClearEventHandlerList (Component component) {
if (component == null)
throw new ArgumentNullException ("component");
FieldInfo fieldInfo = (typeof (Component)).GetField ("events",
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.DeclaredOnly |
BindingFlags.ExactBinding);
EventHandlerList currentList =
fieldInfo.GetValue (component) as EventHandlerList;
if (currentList != null)
currentList.Dispose ();
fieldInfo.SetValue (component, null);
}

For example, a security component could easily remove a control’s behavior* when the user does not have permission. Keep in mind that this is not a substitute for declarative or imperative security checks - other methods can continued to refer to the control's state or subscribe to its events in the future.

Other benefits include the ability for a security component to use a ToolTip to notify the user of access denied (ToolTips do not function on disabled controls).

button.Click += new System.EventHandler (this.button_Click);
// the button_Click method is called when the button is clicked
...
ClearEventHandlerList (button);
// button does not have a click event subscriber anymore
// (button_Click is no longer called when the button is clicked)


* behavior as defined by event subscriptions where the event accessor implementation uses the EventHandlerList class.
Monday
Sep112006

Vista RC1 shutdown notification

The shutdown notifications need additional work in Windows Vista RC1:

  1. Run cmd.exe with administrative privileges

  2. Run the following command:
    shutdown /s /t 600

  3. Abort the shutdown with this command:
    shutdown /a


Notification of an aborted system shutdown in Beta 2 had a strange title:
You are about to be logged off. The scheduled shutdown has been cancelled.

Luckily, Microsoft has enhanced the title in RC1, but there is still room for improvement:
Logoff is cancelled. The scheduled shutdown has been cancelled.
Friday
Sep012006

Network Neutrality

The Internet is not a big truck. It’s a series of tubes. - Ted Stevens

Check out this clip from The Daily Show where John Hodgman explains the technical implementation of the Internet and why we need network neutrality:
The Daily Show With Jon StewartMon - Thurs 11p / 10c
Net Neutrality Act
www.thedailyshow.com
Daily Show
Full Episodes
Political HumorHealth Care Crisis
Monday
Aug282006

Camera metadata

I received a lot of JPEG images taken by multiple cameras at my daughter's birthday party. My first thought was to import them in to Aperture as a birthday album. Unfortunately, these images contained incorrect capture dates preventing me from organized them in chronological order.

Digital cameras have a clock and store the capture date and time as metadata in the JPEG image. The clock must be set correctly for images from multiple sources to be organized in the order in which they were taken.

To have all of the pictures of the birthday party together in chronological order, I had to:

  • Separate all pictures taken by a specific camera by folder

  • Perform the following for each folder:

    • Estimate the date and time of one of the pictures taken

    • Use jhead, a EXIF command-line utility, David found to fix the metadata

      • Use the –da switch to specify the actual and recorded date and time

      • Execute for all JPEG images (*.JPG)

    • Import the pictures in to Aperture.
    • Compare the pictures to others with the correct date and time.
    • If the images don't line up correctly, delete them, and start over again with a better estimate.

Page 1 ... 3 4 5 6 7 ... 10 Next 5 Entries »