Stephen Sulzberger’s Blog

October 12, 2008

Web site that checks for username availability across multiple online services

Filed under: Online tools — Stephen @ 3:04 pm

Great site for checking for the availability of a username across multiple online services: http://usernamecheck.com/ http://namechk.com/

July 21, 2008

Protected: Movie Review: The Dark Knight

Filed under: Movie Reviews,Movies — Stephen @ 9:56 pm

This content is password protected. To view it please enter your password below:

June 11, 2008

I’ve switched from IE7 to Firefox 3

Filed under: Firefox,IE7 — Stephen @ 8:41 pm

I’m now using Firefox (version 3) as my main, preferred browser. In anticipation of the (perhaps obligatory) "welcome to the 21st century"-like remarks, allow me to defend myself in the wake of some initial criticisms concerning my previous extended use of Internet Explorer. This won’t be a technical overview, per se, but more of a chance for me to take stock on some of the things I’ve noticed about my browser use.      

First off, using Internet Explorer (in my case, version 7) can really only be described a matter of convenience. It’s installed natively, it has a fast startup time (since it’s loaded alongside the Windows explorer shell), it’s reasonably sleek (e.g. with regard to its interface and minimal foot print), and, quite simply, it ‘just works’. Clearly, Internet Explorer offers a sort of harmony between the operating system and the browser that’s otherwise impossible to deny – it’s built right in to things and, contrary to what most others think, the browser doesn’t look half bad. I wouldn’t lend much credence to conspiracy theories about Microsoft knowing hidden secrets about their operating system (and, therefore, possibly being able to harness undocumented loopholes for performance gains), but the browser really does feel programmatically efficient and (mostly) solid.       

Of course, none of these are reasons for keeping/using Internet Explorer over other browsers, but they definitely hold some weight when it comes to someone using Internet Explorer – and being happy with it – tout court. This is pretty much the situation I found myself in – Internet Explorer was (and is) quick, relatively painless, and immediate.

This isn’t to say, though, that I haven’t been using Firefox. Most anyone will tell you that web-related development situations make Firefox indispensable – the selection of debugging tools and general add-ons available for it is pretty ludicrous compared to other browsers. But don’t get me wrong – I don’t think there’s anything that Firefox can do that Internet Explorer can’t. Suffice to say, though, that Internet Explorer leaves me wanting when it comes to looking for tools and add-ons that just don’t have the community/developer base that Firefox has. (Of course, the last thing I want is for this to turn into a commentary about open source frameworks having some kind of intrinsic advantage over other infrastructures. If anything, I’m merely pointing to the fact that open/easy SDK’s – and the active communities that leverage them – is what makes pivotal software like web browsers so much more exciting and, ultimately, more productive. Incidentally, how else can you account for the iPhone’s success with the app store? A good [and not necessarily open source] SDK is where the real opportunity is.)          

So, why have I only now decided to ditch Internet Explorer as my primary browser? Firefox just has a better implementation of things, plain and simple. I’ve always known this, but the advent of Firefox 3 has more or less accentuated the subtle underpinnings of Mozilla’s winning approach and has made me ready and willing to ‘take the plunge’, so to speak. Everything from exception management (e.g. restoring your sessions after unexpected terminations) to tools and options layouts… There’s just a kind of work flow that’s hard to beat.  

Will I stop using Internet Explorer altogether? No way – some things still need it, e.g. MS Exchange (for the web-based mailbox), corporate CMS systems, compatibility tests, etc. To be sure, Internet Explorer still has a place in this world, even if it’s only because of proprietary programs or other misc. considerations that keep the browser relevant. (I should also note at this point that up to now I’m not really a huge fan of any of the ‘IE Tab’-sort of utilities for opening Firefox instances using an IE engine. If something requires Internet Explorer for whatever reason, your best bet, I think, is to just use Internet Explorer. This, I think, is the only fool-proof solution.) Still, I suppose one could always counter that some things aren’t Internet Explorer compatible, either (though I’m sure this alleged technological shortcoming is more marketing-driven than anything else). One such example is Apple’s MobileMe service – read about that situation (and some added commentary) from Chris Pirillo and others here.

In terms of lingering frustrations, I really only wish Firefox had a cleartype option/add-on like IE7, that way you wouldn’t need to enable the font setting for your entire system just to have it apply within Firefox. Still, even I can admit that this isn’t much of a wish list for a product that’s already considerably solid and feature-rich.  

May 26, 2008

Use C# ?? null coalescing operator for parsing request query string parameters

Filed under: .net,asp.net,C#,Web development — Stephen @ 7:16 pm

I’m a big fan of succinct code, especially when it comes to satisfying requirements that are ultimately trivial but redundant. That being said, I think the following is the best way to parse query string parameters:

    string sParam = "t"; 
    string sResult = string.Empty; 

    sResult = (Request.QueryString[sParam] ?? "").Trim();

    if (sResult != "")
    {
      // Do something
    }

If the request string param is null, the string returns “”. If the request string param has a value, we snag it and Trim() to ensure that we get what we want and nothing else (this is important, especially since users can toy with the param values and send values with unexpected extra spaces). The idea here is to encapsulate as many “checks” into a simple, quick parse to ensure that you don’t have to back track and validate anything (insofar as handling null or empty data). Notice, also, that I use the Trim() method outside of the “coalescing” routine – this is because if the Request.QueryString[] call returned null, Trim() would throw an object reference exception.

Some other methods you might use for accomplishing the same thing:

Example 1

      string sParam = "t";
      string sResult = string.Empty;
      
      if ((Request.QueryString[sParam] != null) && (Request.QueryString[sParam].Trim() != ""))
      {
        sResult = Request.QueryString[sParam].Trim();
      }

      if (sResult != "")
      {
        // Do something
      }

Example 2

      string sParam = "t";
      string sResult = string.Empty;      
      
      sResult = (null != Request.QueryString[sParam]) ? Request.QueryString[sParam].Trim() : "";

      if (sResult != "")
      {
        // Do something
      }

Example #1 and #2 will each give the same end result and functionality as the null coalescing approach sketched above, but at any rate they contain a lot of redundancy. The null coalescer is the easiest approach of the proffered bunch, I think. 

For more information on the C# null coalescing operator and some other interesting uses (e.g. using it with LINQ), check out: http://weblogs.asp.net/scottgu/archive/2007/09/20/the-new-c-null-coalescing-operator-and-using-it-with-linq.aspx

April 4, 2008

Windows Media Player (wmp) not monitoring folders locally or over network (solution!)

Filed under: Media,Windows Media Player,Windows tips/tricks — Stephen @ 10:46 pm

One of the more prominent reasons I use Windows Media Player is for its seemingly unique monitor folders tool. After recently moving all of my media onto a centralized location on my network, I was hoping this feature would continue to work seamlessly, i.e. keep ‘monitoring folders’ for file updates, removals, or whatever. Long behold, after adding the network share to the associated ‘locations to monitor’ list, a wmp directory scan found all of the media files and iterated through each and every one of them without actually adding anything to the library. Weird.

After a few days of craziness, I finally ran into a solution at: http://weblogs.asp.net/chuckop/archive/2005/03/18/395139.aspx

Essentially the fix entails declaratively removing the “system” attribute from your media files since, apparently, wmp doesn’t like adding file/attribute pairs like that into its monitor routine (although you can add them to the library manually). In my case I’m not sure how the attribute ever got there to begin with (it definitely wasn’t there originally), but I suspect it had something to do with me transferring files through a device controller running linux/samba. 

I’m still on the fence as to whether or not this was a viable programming or business decision on wmp development’s part (I suppose one could contest to the fact that true ‘system’ files need not be monitored), but nevertheless there are loads of people having issues with this.

For more info on modifying the system attribute, visit: http://support.microsoft.com/kb/326549

April 2, 2008

asp.net: Handle comments in xml files

Filed under: asp.net,C#,Web development,xml — Stephen @ 7:29 pm

A small point, but asp.net’s XmlDocument doesn’t seamlessly handle xml comments when iterating through sub elements of an XmlNodeList. It’d be nice if XmlDocument didn’t read comments in the first place (I’d venture to say that xml comments aren’t meant to be read by compiled code), but I suppose it might be useful on some occasions to have the Load() method return everything in an xml doc. 

Not a big deal, but remember to handle comments explicitly any time an editable data file is consumed using the XmlDocument object.

For example, if expecting an xml document such as:

<?xml version="1.0" encoding="utf-8" ?>
<items>
  <item>
    <itemValue>value1</itemValue>
    <!--<itemValue>value2</itemValue>-->
    <itemValue>value3</itemValue>
  </item>
  <item>
    <!--<itemValue>value1</itemValue>-->
    <itemValue>value2</itemValue>
    <itemValue>value3</itemValue>
  </item>
</items>

The following approach (or similar) would need to be used in order to prevent the commented areas from being processed as bona fide elements:

    XmlDocument xmlDoc = new XmlDocument(); 
    xmlDoc.Load(HttpContext.Current.Server.MapPath(@"~\App_Data\file.xml"));

    XmlNodeList nodeRoot = xmlDoc.GetElementsByTagName("item");

    for (int i = 0; i < nodeRoot.Count; i++)
    {
      XmlNodeList objNodes = nodeRoot[i].ChildNodes;

      foreach (XmlNode node in objNodes)
      {
        if (node.NodeType == XmlNodeType.Comment)
          continue;

        // Do something.
      }      
    }

In this case, “objNodes” actually contains 3 elements for each item – 2 elements with NodeType Element and 1 element with NodeType Comment. If this is not handled properly in the iterations, it is possible for the code (or general routine) to fail supposing that an element is commented out with the intention for it to not be processed.

For more information: http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.value.aspx

March 23, 2008

Does the ext2 file system need to be defragmented?

Filed under: ext2,Linux — Stephen @ 11:48 am

In a word, no.

http://cbbrowne.com/info/defrag.html

I’m convinced.

Why I cared in the first place: http://forum.source.pri.ee/viewtopic.php?id=1578&p=2

February 29, 2008

Capture color code from screen

Filed under: Web development — Stephen @ 8:22 pm

http://instant-eyedropper.com/
“Instant Eyedropper is a free software tool for webmasters that will identify and automatically paste to the clipboard the HTML color code of any pixel on the screen with just a single mouse click.”

http://colorcop.net/
“Color Cop is a multi-purpose color picker for web designers and programmers.”

February 9, 2008

BalloonTipTitle and BalloonTipText max length

Filed under: .net,C#,Windows API — Stephen @ 2:55 pm

NotifyIcon.BalloonTipText max length = 255 characters
NotifyIcon.BalloonTipTitle max length = 63 characters

Source: Trial and error.

Good luck finding these specs anywhere. Seems to be one of the lesser documented items in the Windows API (or it requires a very specific search term). Funnier still is you won’t get any compiler errors in Visual Studio 2005/2008 if your string is longer than the above mentioned lengths – you’ll just have to wait for your balloon tip to get cut off when it’s displayed.

Firefox add-ons – development tools (best of)

Filed under: Extensions,Firefox,Web development — Stephen @ 2:30 pm

Some Firefox add-ons I’ve found indispensable for web development and everyday use:

Cookie Manager Button – Creates an icon on the navigation toolbar for quick access the Cookie Manager.
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/3402

QuickJava – Allows quick enable and disable of Java and Javascript from statusbar.
Site: http://quickjavaplugin.blogspot.com/
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/1237

Firebug – Edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.
Site: http://www.getfirebug.com/
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/1843

Flashblock – Enables/disables flash for web sites that you designate.
Site: https://addons.mozilla.org/en-US/firefox/addon/433
Add-on page: http://flashblock.mozdev.org/

WebMail Notifier
Site: http://webmailnotifier.mozdev.org/
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/4490

Tabs Open Relative
Site: http://jomel.me.uk/software/firefox/tabsopenrelative/
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/1956

User Agent Switcher – Adds a menu and a toolbar button to switch the user agent of the browser. (Useful for testing browser-specific sites.)
Site: http://chrispederick.com/work/user-agent-switcher/
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/59

CSSViewer – A simple CSS property viewer.
Site: http://www.nicolashuon.info/?page=work&type=projects&id=cssviewer
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/2104

Firecookie – An extension for Firebug that makes possible to view and manage cookies in your browser.
Site: http://www.softwareishard.com/blog/firecookie/
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/6683

CacheViewer – GUI Front-end for “about:cache”.
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/2489 

IE Tab – View web page displayed in IE but within Firefox tab.
Site: http://ietab.mozdev.org/
Add-on page: https://addons.mozilla.org/en-US/firefox/addon/1419

Next Page »

Blog at WordPress.com.