MET CS 601

MET CS 601 project, using "click relevency" for it's list, is still available here

Labels: , ,


Open an App using a Registered URL

I found this code snip at Christina's site and found it works well with any registered URL, including those custom URL Protocols that you may register .

string url = @"http://www.ricklafleur.com";
Process.Start("rundll32.exe", "url.dll,FileProtocolHandler \"" + url + "\"");

Labels: ,


Register Application as a Url Protocol

There are times when it is appropriate for an application to be called via a URL and be passed data, such as "myprotocol://open?id=100”. The following code shows how an application can self register itself to handle a URL protocol.

public void RegisterUrlProtocol(string myUrlProtocolName, bool force,)
    RegistryKey rKey = Registry.ClassesRoot.OpenSubKey(myUrlProtocolName, true);

    if (force || rKey == null)
 rKey = Registry.ClassesRoot.CreateSubKey(myUrlProtocolName);
 rKey.SetValue("", "URL:"+ myUrlProtocolName+" Protocol");
 rKey.SetValue("URL Protocol", "");

 rKey = rKey.CreateSubKey(@"shell\open\command");
 rKey.SetValue("", "\"" + Application.ExecutablePath + "\" %1");

    if (rKey != null)

Labels: ,



Intrested in where your visitors are from? Check out this little widget from Clustermaps.com:

Locations of visitors to this page

Labels: , ,


Missing standard for minimum URL length.

Applications differ on their support for URL length because the specification fails to indicate any requirement for a minimum URL length (http://www.w3.org/Addressing/URL/url-spec.txt). MS Internet Explorer, for example, only support 2046 characters in it’s address box, a fraction of what other contemporary browsers will support. The Microsoft .NET Hyperlink component supports a much shorter URL, silently truncating the address, and Office applications and desktop shortcuts will fail to recognize links of even a moderate size.

The impact is that URLs with complex queries cannot be constructed or used reliably by many applications.

While there are design alternatives, such as using POST to send data to a server based session, any design choice that does not maintain the explicit page state in the URL will likely confuse users. That is, users expect that if they bookmark a page, they can come back to that page, even after a server side session has expired, and it will render identically. Other web paradigms include using the Web browsers back button to undo an action, something that .NET and AJAX applications frequently fail at since they don’t update the URL when updating the page state. For a demonstration of this, observe how even MS’s Live.com site maintains page state in the URL rather then use the .NET paradigm of post backs to the server.

So on the one hand, maintaining page state in the URL is desirable for usability, but on the other hand the inconsistency of support for URL lengths ensures the design will, in some case or another, fail. In some cases the failure may happen in such a way that the user is unaware of the failure –as when additional query parameters are truncated and the resulting page is not as expected. For example, a query that contains key=foo+AND+bar” and is truncated to key=abc would likely result in a silent failure.

To defend against these silent failures a Web application must be designed to test for a truncated URL. How this is done depends upon the application. For example, in one application a special character or keyword may be is placed at the end of an applications URL if it contains a query. In another, the query includes a parameter for URL length that is tested for. The key is that is that the pages URL cannot be assumed to be valid unless there is a test for validity.

Labels: ,


Using SyntaxHighlighter on Blogger site

Using the SyntaxHighlighter on non Blogger sites is pretty straightforward - for my notes on use, please see Using SyntaxHighlighter.

However, I and other have run into a bug when trying to deploy to a Blogger site, namely that <br/> would be inserted in the code when displayed to the page and, in my case, line returns would be ignored, resulting in all the code being writtent to one line.

I was able to find a solution on the Tips for software engineer site. In essence, add the following JavaScript to the page just before the closing body tag:

<script class='javascript'>  
     function FindTagsByName(container, name, Tag)  
         var elements = document.getElementsByTagName(Tag);  
         for (var i = 0; i < elements.length; i++)  
             if (elements[i].getAttribute("name") == name)  
     var elements = [];  
     FindTagsByName(elements, "code", "pre");  
     FindTagsByName(elements, "code", "textarea");  
  for(var i=0; i < elements.length; i++) {  
   if(elements[i].nodeName.toUpperCase() == "TEXTAREA") {  
    var childNode = elements[i].childNodes[0];  
    var newNode = document.createTextNode(childNode.nodeValue.replace(/<br\s*\/?>/gi,'\n'));  
    elements[i].replaceChild(newNode, childNode);  
 else if(elements[i].nodeName.toUpperCase() == "PRE") {  
    brs = elements[i].getElementsByTagName("br");  
    for(var j = 0, brLength = brs.length; j < brLength; j++) {  
     var newNode = document.createTextNode("\n");  
     elements[i].replaceChild(newNode, brs[0]);  
   //clipboard does not work well, no line breaks  
   // dp.SyntaxHighlighter.ClipboardSwf =   
   //"http://[YOUR HOST]/clipboard.swf";  

Labels: , , ,


Using SyntaxHighlighter

Following provides details on adding the Google SyntaxHighlighter to a non Blogger site.

<link type="text/css" rel="stylesheet" href="/css/SyntaxHighlighter.css"></link>
<script language="javascript" src="/js/shCore.js"></script>
<script language="javascript" src="/js/shBrushCSharp.js"></script>
<script language="javascript" src="/js/shBrushXml.js"></script>
<script language="javascript">
dp.SyntaxHighlighter.ClipboardSwf = '/flash/clipboard.swf';

<pre name="code" class="c-sharp">
string [] s = {"a", "b", "c"};
for (int i = 0; i < s.Length; i++)

However, if using integrating with Blogger you may observe some problems - if so check out this article.

Labels: , ,


How to change a div visibility within a ContentPlaceHolder

Assuming a div id="showdetails", it’s visibility can be set using following:
ContentPlaceHolder content = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1");
content.FindControl("showdetails").Visible = true;

Labels: , , ,


January 2007  |   March 2007  |   May 2007  |   February 2008  |   April 2008  |   July 2008  |   September 2008  |   October 2008  |   December 2008  |   January 2009  |   April 2009  |   May 2009  |   June 2009  |   December 2009  |   January 2010  |  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]