Wednesday, April 20, 2005
by Nik Kalyani
Wednesday, April 20, 2005 8:46:40 AM (Pacific Standard Time, UTC-08:00)

The Secrets of Strong Naming by Mike Gunderloy -- If you've been working with .NET for any length of time, you've probably run across the concept of a strong name. No, that doesn't mean that your assemblies should have names like MyCompany.Gorilla.Biceps. The strength of a strong name lies in the protection that it offers your assemblies. The .NET Framework uses strong names to identify assemblies and to protect them from tampering. In this article, Mike Gunderloy shows you how strong names are constructed and demonstrates the mechanics of working with strong names in .NET.

 

 Tuesday, April 19, 2005
by Nik Kalyani
Tuesday, April 19, 2005 4:07:50 PM (Pacific Standard Time, UTC-08:00)

Navin Pathuru asks:

Currently we have a requirement where our client wants us to do something about loading Dnn in Netscape 4.x version. We know Dnn uses a lot of client side javascript so there are going to be problems with this. But we just
want to do our best. The approach we want to take is to figure out the browser version and load a different
skin one which has really minimal graphics when we detect it is Netscape 4.x. I am wondering if you will
be able to write your thoughts about this approach in your blog.

Nik’s response:

Navin, this is a great question. Before I answer it, I do want to point out that most of the client-side Javascript you see on a DNN page is emitted by ASP.Net, the menu and other modules. DNN itself does not generate a lot of client-side script, especially if you disable the Client API.

Now, to answer your question. Since we have the DNN source code, the dime answer is change the core to suit your needs. But this is neither fun nor practical. Let’s go on to the dollar answer.

DNN uses the tab settings (inherited or set directly) to determine which skin is to be displayed. You can override this with querystring parameters to force a certain skin to be displayed. Also, due to its IBuySpy legacy, DNN has the rather unfortunate artifact called the Admin skin which forces a skin switcheroo whenever a non-View module control is displayed. (I think this will go away as part of DNN’s continued evolution.)

So, if there is no way to dynamically switch the skin, how is this problem to be solved. After noodling about this for a minute, it occurred to me. Although DNN allows skins to be intelligent, most skins are dumb, i.e. they intersperse some DNN controls, HTML, images and CSS to render a page layout. Most skins do not take advantage of their ability to do anything ASP.Net allows by virtue of their being usercontrols. This is precisely what we can do to solve the problem at hand.

The solution consists of a single file that I’ll call a “Skin Proxy.” The Skin Proxy can be used to dynamically select a skin based upon any user, portal, tab or browser properties. In my example, I have used a browser property since that was the focus of Navin’s question. Basically, the Skin Proxy creates a string based on some browser properties and then attempts to load a control (i.e. a skin) with a name matching the string.

SkinProxy.ascx

<%@ Control language="c#" %>
<script runat="server">
 protected void Page_Load(object s, EventArgs e)
 {
     string browser = Request.Browser.Browser.ToLower();
     string version = Request.Browser.MajorVersion.ToString();

     if (Request.QueryString["debug"] != null)
         Response.Write(browser + version + ".ascx");
     else
        {
             try
             {
                 this.Controls.Add(this.LoadControl(browser + version + ".ascx"));
             }
             catch
             {
                 this.Controls.Add(this.LoadControl("Default.ascx")); 
             }
        }
 }
</script>

In this code, the first couple of lines get the browser and browser major version into string variables. Then, an attempt is made to load a control whose name corresponds to the concatenated browser and version. If this is unsuccessful, a control named “Default.ascx” is loaded. (If you add a querystring variable named “debug” the script reports the name of the control that would be loaded instead of actually loading it. This is helpful for figuring out what to name your control.)

I tested this out with IE and Firefox and everything seemed to work OK. Please do post here if you find problems with the script.

 

 Monday, April 18, 2005
by Nik Kalyani
Monday, April 18, 2005 3:50:26 PM (Pacific Standard Time, UTC-08:00)

I don’t think I will be using Yahoo maps again. Nothing against Yahoo. It’s just that Google maps are so much cooler. There’s nothing like seeing a satellite map of your intended travel route and close-ups of each turn along the way.

Just for fun I mapped the walk from my place to the White House. Be sure to click on the numbers next to each turn instruction.

#    Comments [0] - Trackback    

 Friday, April 15, 2005
by Nik Kalyani
Friday, April 15, 2005 8:14:32 PM (Pacific Standard Time, UTC-08:00)

I am continually baffled by how some people are always seeing conspiracies where none exists. The latest debacle was the launch of the DotNetNuke Online Help. Ignoring the fact that my Navigator module is used for delivery, I think it’s a fantastic feature. And for free, to boot. But some people didn’t see it that way judging from the posts in the DotNetNuke forums on ASP.Net. People complained abou tthe fact that the Online Help link went straight to DotNetNuke.com and changing it required a wee bit of work. How awful!!!

I guess people who have concealed from their clients the fact that DNN is what’s driving the $5,000 website they “developed” have a concern that their little secret will be exposed when the client clicks on that View Online Help link and discovers that they’ve been had. What amazed me even more is that these individuals expended more time and energy on complaining than finding a workaround that did not require a re-compile. Setting aside the sheer ludicrousness of people complaining about software created by volunteers, for free, under an amazingly liberal license, one has to wonder about the business ethics of these people. I have lost all respect for the people who expressed such views.

Anyway, I try not to get involved in these asinine arguments, because they are quite pointless. (So please don’t bother posting any comments about the above. It’s my opinion, on my blog and I don’t care to discuss it.) What I do like to do is solve problems, especially technical ones. And this is a nice, juicy problem.

So, if you don’t want to change the link in the database, and you don’t want to recompile, what other option is there. Well, turns out that the link text is localized. So it should be pretty simple…just blank out the text in the language file and you’re good to go. Not quite. If the localization text is blank, the control reverts to displaying the text value that’s defined in script.

Ah, an even more interesting problem. After mulling it over for a bit, I came up with an amazingly simple solution. Here’s what I did:

– Opened ~/controls/App_LocalResources/Help.ascx.resx in Notepad

– Found the line containing the key cmdHelp.Text and changed its value to:

&lt;script language=javascript&gt;this.parentNode.style.display=&quot;none&quot;&lt;/script&gt;

That did it. If it isn’t already obvious, what the text above does is insert some Javascript as the link value so that the hyperlink is prevented from being displayed.

That was fun.


 

 Tuesday, April 12, 2005
by Nik Kalyani
Tuesday, April 12, 2005 8:00:35 AM (Pacific Standard Time, UTC-08:00)

Now that the Speerio File Manager Pro module has out for a few days, I have had a chance to experience it as an end-user instead of a developer. My favorite features have become:

1) Folder explorer and drag-and-drop folder moves.

2) Self-extracting zip creation

3) Huge file uploads

4) Private user folders, and

5) Auto-populate user folders with default content.

 

RSS feed
Search and Links
Bling

View Nik Kalyani's profile on LinkedIn

Contact me: nik*kalyani.com (replace "*")

TechBubble
www.flickr.com
This is a Flickr badge showing public photos from techbubble. Make your own badge here.
Statistics
Total Posts: 204
This Year: 22
This Month: 0
This Week: 0
Comments: 231
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008
Nik Kalyani
Sign In
All Content © 2008, Nik Kalyani