A Class in App_Code Folder Does Not Get Compiled

Today I’ve experienced one odd thing with Visual Studio 2008.
As we know, App_Code is not needed for a Web application project under VS2008 since class files can be put anywhere.
However, to keep it clean and easy to find, I decided to created one and create class files under the folder.
It appears that those created objects do not be available.
In the other words, they do not get compiled.
After messing around, I found that the “Build Action” property of those files have been set to “Content” by default.
Well, it should be “Compile” so that the files get compiled.
I’ve also tried to create another folder with the name of “cs”.
The created class files under “cs” have the “Build Action” property of “Compile”.
Therefore, the solution is either set the “Build Action” property to “Compile” or never use a folder with the name of “App_Code”.

Now the question is… why does the “Build Action” property of the files under “App_Code” is “Content”?

Case-Insensitive XPath Searching

As far as I know, there is no such xpath function to do the case-insenstive search.
However, there is a work-around for this.
The solution is to receive a lower-case string as the input and use lower-case() xpath function to help perform the search.
Consider the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<specification>
  <name>ASUS Striker</name>
  <manufacturer>ASUS</manufacturer>
  <model>Striker</model>
</specification>

The following xpath do the search for “asu” which returns two string - “asus striker” and “asus”:

/specification//lower-case(text())[contains(.,'asu')]

As we can see, using lower-caes() and contains() helps search for lower-case string even though the xml contains upper-case string.
The text() function indicates the value of the node in context.
You can also try name() which indicates the name of the node.
You can try using upper-case() with upper-case input string as well.

VMWare Workstation on Windows Server 2008

I’m currently in a progress of deciding whether to VMWare Workstation or Hyper-V on my Windows Server 2008 for a development environment.  At first, I meant to seek for the one with better performance.  However, I’ve come across one article at diTii.com about an issue on using VMWare Workstation on Windows Server 2008.  Below is what they say.  It’s good to know this stuff beforehand.  Thanks :)

Due to the fact, in the current Intel/AMD chip architecture, only one hardware-based hypervisor can run at a time, you will want to create a special boot entry for a Hyper-V-less boot time configuration of Windows 2008. Assuming you are currently booted into Windows 2008, at an administrative command prompt, type the following:

bcdedit /copy {current} /d “Windows 2008 (No Hyper-V)”

The above command should say: The entry was successfully copied to {guid}.

Copy that {guid} to the clipboard including the curly braces.

Now, type the following command:

bcdedit /set {guid} hypervisorlaunchtype off

In the above command, replace {guid} with what you into the clipboard.

Boot into the ‘Windows 2008 (No Hyper-V)’ instance and you will no longer bluescreen while running VMWare guests.

Space Under An Image in IE

When adding an image in a <div> (as shown in the HTML code below), IE displays a little white space below the image.  This doesn't happen on Firefox though.

<div>
    <img alt="Pronto Marketing - How We Help You" src="/img/home_img2.png" />
</div>

stolenbit_space_under_image_ie

The fix is simple, just put the closing div tag </div> on the same line as the image and the problem is fixed:

<div>
    <img alt="Pronto Marketing - How We Help You" src="/img/home_img2.png" /></div>

stolenbit_space_under_image_ie_removed

Tell Your DotNetNuke Module Setting Page To Load Module.css

By default, module.css does not get loaded for a module's setting page.  To let it load the file, add the following code (in C#) to your module setting code behind file (settings.ascx.cs):

protected void Page_Load( object sender, System.EventArgs e ) {
    DotNetNuke.Framework.CDefault DefaultPage = (DotNetNuke.Framework.CDefault)Page;
    DefaultPage.AddStyleSheet( "ModuleSettingStyles", string.Format( "{0}/module.css", this.ModulePath ), true );
}

Debugging a DotNetNuke Compiled Module in VS2008

If you are using VS2008 to create a DNN module with a compiled module starter kit, one option is to attach the project to w3wp.exe process.  You can access it via Debug > Attach to Process... menu.

stolenbit_attach_to_w3wp

If attaching the project to w3wp.exe doesn't seem to be an option somehow (e.g. you just cannot find it), what you need to do now is to modify some project settings as shown below.

In my case, I've create a host record with local.dotnetnuke as the host name.  In your case, you may want to replace http://local.dotnetnuke with http://localhost/dotnetnuke, for example.  Please note that I've saved my project under /DesktopModules/ContactUsForm.  So my project url becomes http://local.dotnetnuke/DesktopModules/ContactUsForm.

stolenbit_debugging_dotnetnuke_compiled_module_vs2008

Save the project and try running it again.  You should now be able to debug the project Wink

Cannot Resolve Collation Conflict for Column n in SELECT Statement

When creating a stored procedure and it contains a SELECT statement, you may get the following error message even if the collation of your database seems to be correct.

Cannot resolve collation conflict for column n in SELECT statement.

where n is the column number.

This can be easily fixed by appending the following portion of SQL to the column n in your SELECT statement:

COLLATE <your database collation name>

For example, COLLATE SQL_Latin1_General_CP1_CI_AS.

The database could not be exclusively locked to perform the operation

When trying to change the collation of a database, you may get the following error message:

The database could not be exclusively locked to perform the operation.

To workaround this problem, we first need to set the database for single user.  And change it back for multi user after changing the collation.

ALTER DATABASE <database_name> SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE <database_name> COLLATE <target_collation_name e.g. SQL_Latin1_General_CP1_CI_AS>
ALTER DATABASE <database_name> SET MULTI_USER

Access to the Path... is denied

When your ASP.NET application tries to access a file in a folder, you may get an error message saying "Access to the path <file path> is denied.".  To solve this problem, you will need to provide permissions for NETWORK SERVICE (Windows 2003/2008) or ASPNET (Windows XP) account to access the folder containing that file.  To provide the permissions, do the following:

  1. Right click on the folder and select Properties.
  2. Go to Security tab (if it doesn't appear, see below) and click on the Edit... button under Group or user names section.
  3. Click on the Add... button and, on the popup window (titled Select Users or Groups), click on the Advanced... button.
  4. Click on the Find Now button.
  5. Select NETWORK SERVICE (or ASPNET) account and click OK twice to go back to the permissions window.
  6. On the Permissions window, select the account and check Allow for Full Control.
  7. Click OK twice to close the Properties window.

Now your ASP.NET should have an access to the folder.

What if the Security tab doesn't show up?

You'll need to uncheck the Simple File Sharing option in folder options.

  1. On the Tools menu of your windows explorer, select Folder Options.
  2. On the View tab, scroll down until you find the option saying "Use Simple File Sharing (recommended)".
  3. Uncheck it and click OK to accept the change.

Now the security tab should appear and you can start configuring the permissions as stated above.

Two Great Firefox Extensions for RSS and Google Bookmark

The first extension I would like to recommend is RSS Ticker.  As you may have already known, Firefox can act as an RSS feed reader and you can just bookmark a feed as if it were a Web page.  RSS Ticker displays and scrolls a list of those feeds right under your menu bar.  Go ahead and give it a try.

stolenbit_view_feed_xml

 stolenbit_rss_subscribe

stolenbit_display_in_ticker

That's it.  When there is a new post, you'll get notified right on your Firefox Hot

Another extension that I've found to be very very useful is Google Bookmark IncSearch.  As you browse across the Web and find some useful pages that you want to keep, one way is to bookmark it on Google Bookmark so that you can access your bookmarks from anywhere.  However, sooner or later, you will find yourself store TOO MANY bookmarks and just you don't seem to find what you want within your own bookmarks - even though you've well organized them.  And you probably end up with googling for what you want again -*-  Well, it would be nice if you can just search within your bookmarks if you know it IS there, wouldn't it?  Google Bookmark IncSearch can help.  OK.  That's enough for saying.  Give it a try and I'm sure you'll love it just as I do Happy

 stolenbit_google_bookmark_incsearch

Enable Remote Connection on SQL Server 2008

By default, Microsoft SQL Server 2008 doesn't allow any remote connection.  What we'll need to do is to enable TCP/IP protocol in SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for <InstanceName> and enable the TCP/IP protocol as shown in the picture below.  An example of InstanceName is MSSQLSERVER.

stolenbit_enable_remote_connection_on sql_server_2008

After restarting SQL Server (InstanceName) service (as shown below), it should work without any problem.  You can quickly access the services windows by going to start menu > run > type services.msc.  Locate the SQL Server (InstanceName) service, right click on it, and choose restart.

stolenbit_sql_server_service

In my case, completing these steps enables me to connect from a remote machine successfully.  However, someone reported that we also need SQL Server Browser service running too.  Therefore, if completing the steps above doesn't help you get connected, you may try setting SQL Server Browser service to Automatic and start the service.

Failed to map the path..."

When you create a new .NET Web application under a default Web site in IIS 7 (so the URL of your new Web application will be http://localhost/mywebsite, for example), you may encounter an error saying "Failed to map the path...".

To get rid of this error, make sure that the application pool of your new .NET Web application and the application pool of the default Web site are the same.  The following pictures show the cause of the error:

default_web_site

new_web_app

Change the application pool of the latter one to be the same of the first one solves the problem Angel

This row already belongs to another table."

When you try to add a DataRow from one table to another, you may encounter the following error message:

"This row already belongs to another table."

This error message appears if you try to add (copy) a DataRow from table1 to table2, for example, with the following C# code:

table2.Rows.Add(row);

where row is a DataRow object from table1.

To successfully copy the row, you'll need to use ImportRow() method:

table2.ImportRow(row);

Don't forget to define a proper value of column number for table2 first or no data will be displayed if you bind table2 with a gridview, for example.

WSS 3.0 Security Groups

In WSS 3.0, there are three (3) out-of -box security groups.

  1. Owners (Full-Control)
    • Get full access to the entire site and its subsites.
  2. Members (Read/Write)
    • Have "Contribute" permission level associated.  This "Contribute" permission level gives members quite a bit of power and could be out of control sometimes.
    • Members cannot see "Site Actions" button and those items hidden by an admin.  However, by default, they CAN edit and delete an item created by an admin!!! ("Contribute" permission level)
  3. Visitors (Read-Only)
    • Though visitors cannot see the "Site Actions" button, cannot do site personalization, and cannot edit or delete items, they, by default, CAN modify a shared document -*-
    You can create your own SharePoint groups.
    MOSS 2007 comes with more out-of-box groups.

<< Back to [70-631] TS: Configuring Microsoft Windows SharePoint Services (WSS) 3.0 - Exam Notes

www.localhost.com Nightmare

When you're working with Visual Studio and trying to run a web application project, you may encounter a problem of the URL change from http://localhost to http://www.localhost.com

This is caused by the IPv6 issue.  Look in your hosts file (usually located under C:\Windows\System32\drivers\etc).  Look for the line:

::1    localhost

Comment it out with a # sign and it'll become:

#::1    localhost

That's it. You're now up and running Hot

IIS7 - Authorization Failure - Cannot verify access to path...

Authorization_Failure
Authorization_Local_User
Authorization_Success
When creating a new web application in IIS 7, you may encounter an authorization failure when clicking on the "Test Settings..." button as shown in the first picture. This is because the Web application is configured to use pass-through authentication which somehow may not have enough permission to access the physical folder of the Web application. Skull
One way to work around is to create a new local user and give it an administrator role. In my case, I setup a new administrator account and named it "iis". Now click on the "Connect As..." button to set a new user for this connection and, of course, use the created one.
After clicking OK and test the settings, you will not get any warning message again. Big Grin

Select ASP.NET Version in IIS 7

IIS7_Select_ASPNET_Version

In IIS 7, ASP.NET version selection is different from that on the earlier versions of IIS.  In this version, the ASP.NET version is specified in an application pool.  You can create a new application pool and let your Web application use it (see picture on the left).

Using a separated application pool also gives you a better performance - in exchange of resources though.

[70-631] TS: Configuring Microsoft Windows SharePoint Services (WSS) 3.0 - Exam Notes

The list below is a summary of what we (probably) need to know for the 70-631 exam (configuring WSS 3.0).  More items and details on each item will come later.

  1. Use Unicast mode to solve IP address conflict problem for intra-array communication.
  2. NLB (Network Load Balancing) help distribute loads/requests across servers.
  3. Install Web server certificate from WSS server on ISA to ensure that all external requests are inspected and encrypted.
  4. Deploy ISA and publish WSS web site to prevent direct access from outside of the network to the WSS server.
  5. To decommission and migrate all sites from one server to another on a different farm, edit the host record of the old server and configure IP address of the new server.
  6. Configure AAM (Alternate Access Mapping) to allow remote users to access WSS Web site via a specific URL.
    ThinkingA SharePoint site can respond to more than one URL. In this aspect, it's similar to setting multiple URLs for a Web site in IIS.
  7. Create a host record in DNS zone with a name value of WSS that maps to the IP address of the NLB cluster to ensure that each server in the cluster receives requests for WSS content.
  8. Configure Event Throttling to write events to Windows event log.
  9. We can review the IIS logs to verify that all access to the WSS Web site is encrypted.
  10. Enabling Diagnostic Logging to have a WSS server create trace logs.
    Vampire BatTracing involves occurrences of particular events.
  11. Let MOM (Microsoft Operations Manager) take care of the services across all WSS servers.
    ChickenDon't forget to install WSS management pack for her.
  12. Also let MOM take care of the HTTP errors.
    ChickenDon't forget to install IIS management pack for her.
  13. Include Network Interface, Processor, and Physical Memory objects in a counter log to identify potential hardware bottlenecks.
  14. To remove all customizations on a page without losing any data, enable the "Reset specific page to site definition version" option in the site settings.
  15. To create a Web page with custom Web Part zone layout, use Microsoft Office SharePoint Designer 2007.
  16. An image put in the default.master file will appear on all pages in a WSS Web site.
    Light bulbA master page helps keep consistency across multiple pages.
  17. For developers - Always include error handling in the code when creating a custom Web Part.
  18. To have requests distributed across multiple servers while having the content centralized, deploy 2+ front-end servers and store content database on a single instance of SQL Server.
  19. To upgrade from WSS 2.0 to WSS 3.0 without losing any existing URL, just install WSS 3.0 over the existing WSS 2.0 deployment.
  20. To be able to access sites in languages other than English after an upgrade, we need to install the language pack template pack on WSS 3.0 server and run the SharePoint Products and Technologies Configuration wizard.
  21. If multiple WSS Web sites are run on the same WSS server, be sure to configure each Web application to run in its own application pool so that they don't affect each other.
  22. Installing WRM (Windows Right Management) client SP2+ on each front-end Web server can help prevent users from printing or saving documents.
  23. You can create a custom group and allow requests to join or leave the group so that users can automatically submit a request to obtain elevated permission levels and only approved users are granted.
  24. To ensure that external users can authenticate before they're grated access to a Web site, specify the authenticate provider in the web.config file.
  25. Enable anonymous access to Web application and Web site so that all Internet users have access to the WSS Web site.
  26. To have SSL encryption enabled for all requests, install a certificate on each front-end server that receives the requests.
  27. Obtaining a certificate from a trusted certification authority (CA) ensures that users do not receive SSL errors from their Web browser.
  28. "Members" permission level users can only view and add content to a document library. Gift with a bowRead more...
  29. Using a member of dbcreator and securityadmin SQL Server 2005 server roles as the database installation account when installing SQL Server will minimize the amount of permissions provided to all users.
  30. When using a custom authentication provider, be sure that the connection string details, membership, and role information in web.config file are for the custom authentication provider.
  31. You can add content types to a document library to specify what types of documents a user will see when he clicks on the "New" menu item.
  32. Backing up your Web application and content database using Central Administration helps minimize the time required to restore in the event of server failure.
  33. You can use STSADM.EXE to add and deploy .wsp customization file.
  34. You can also use STSADM.EXE to backup a site from one server and restore it on another server.
  35. A deleted document stays in the stage-1 (site-level) recycle bin for 30 days by default before getting purged to the stage-2 (site collection-level) recycle bin.
  36. In the case of pre-authentication failure for a specific application pool identity account, you'll need to reset the password for both the application pool identity account and the corresponding user account.
  37. To allow access to a Web site from a mobile device, activate the MobilityRedirect feature for that Web site.
  38. You can change a default database server in the Central Administration so that any new WSS Web site will store content on the new database server.
  39. You can use the Three-state workflow to ensure that operations run in order.
    PumpkinMOSS 2007 provides more OOB (out-of-box) workflow.
  40. To ensure that all users can view the public documents, in the Web application settings, configure the WSS server to use an HTML viewer server.
  41. PASSED! Peace Sign

DotNetNuke Module Error " It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level."

When creating a DNN C# module using a starter kit on this website, for example, you may encounter the following error when trying to run the module:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.
Taken a look at the solution created by the starter kit, it creates a web.config file.
This file is what causes the problem.
Just deleting it or renaming it to something else like web.config.bak solves the problem :)
Bookmark and Share

New Google Favicon for Firefox Search Bar

GoogleNewFavicon As we all know that Google has been using a new favicon for quite sometimes.  But on our Firefox search bar, the favicon is still that capital "G".  Here is how to make it a new one:
 
 
 
  1. Locate the google.xml file under %Program Files\Mozilla Firefox\searchplugins.
  2. Open it and locate the line starting with <Image width="16" height="16">.
  3. Change the value of this tag (data:image/x-icon;...) to the text in this file.  
  4. Save it and restart Firefox.
Bookmark and Share

Advantages, Disadvantages, and When To Use XSLT

According to this web site, here are some advantages and disadvantages of XSLT:
 
Advantages
 
  • Easy to merge XML data into a presentation
  • More resilient to changes in the details of the XML documents than low-level DOM and SAX
  • Database queries can be returned in XML
    • Insensitive to column order

Disadvantages

  • Memory intensive and suffers a performance penalty
  • Difficult to implement complicated business rules
  • Have to learn a new language (if not already familiar)
  • Can't change the value of variables (require recursions)
XSLT has been designed to use with XML.
Therefore, a scenario that most of the work involves XML transformation (e.g. to HTML or another XML tree) is probably the best scenario to use XSLT.
One example is the communications among organizations via Web Services where XML is used for data exchange.
For a normal website development, some other languages e.g. ASP.NET or php could probably be better choices.
They can handle complex business logic better than XSLT.
 
Question
In term of a website maintenance where XSLT is needed in some parts, is it better to have every page transformed to aspx (or php, or whatever) using XSLT or to mix both normal aspx and XSLT pages?  In term of performance, I guess only use XSLT when needed is a better choice.  If the performance penalty for using XSLT can be negated, I believe using XSLT for the whole site could be a better idea (for the maintenance reason).
Bookmark and Share

JavaScript innerText property and Firefox

Just a very short note:
 
Firefox doesn't support innerText JavaScript property.
You'll need to use textContent property instead.
 
Example:
var tagBrowser = document.getElementById('BrowserName');
var hasInnerText = tagBrowser.innerText != undefined? true: false;
 
if(!hasInnerText){
    tagBrowser.textContent = 'Firefox';
}else{
    tagBrowser.innerText = 'IE';
}
Bookmark and Share

IE & <DIV> with CSS - width and height of 100%

When using <DIV> with width and/or height of 100% in IE and it doesn't expand as expected,
try using a <TABLE> to wrap around that <DIV> and set the style of the <TABLE> to have width and/or height to be 100%.
 
I had this problem when using <DIV> without <TABLE> wrapping around it on IE7 - no problem in Firefox though.
The height of the <DIV> doesn't expand to 100% as set.
Wrapping around it with <TABLE> solves this problem.
However, it shrinks the width a bit so I need to set width to 100% as well.
 
In the case of multicolumns layout, some <DIV> might not expand vertically to the height of the longest column.
Wrapping it with another <DIV> and adding a <DIV> with style of {clear: both;} right before closing the wrapper should do the work.
Below is an example:
<div class="contentwrapper">
    <div class="leftcolumn"></div> <!-- float left -->
    <div class="rightcolumn"></div> <!-- float right -->
    <div style="clear: both;"></div>
</div>
This should work for both Firefox and IE :)
Bookmark and Share

Saxon for .NET - exception.Encoding: windows-874 not found

MSXML currently supports only XSLT 1.0.
To benefit from XSLT 2.0 under .NET environment, you need some other XSLT processors.
For some reasons, I have chosen Saxon.
 
Saxon provides .NET developers with a number of objects to interact with XML and XSLT.
To use Saxon without installing to GAC, you need to have all of the following 5 files and make references to the 4 dll files:
 Magical Snap - 2008.06.23 16.31 - 001Magical Snap - 2008.06.23 16.35 - 002
** These dll files are based on Saxon-B 9.0 for .NET.
     They may be changed depending on Saxon's version (e.g. Saxon-B 9.1.0.1 - IKVM.GNU.Classpath.dll is changed to IKVM.OpenJDK.ClassLibrary.dll).
 
The following is a sample fragment of code for transforming XML: 
 
using Saxon.Api
...
 
using (TextReader sXsl = new StreamReader("myXslFile.xslt", Encoding.UTF8)) {
    Processor processor = new Processor();
    XsltCompiler compiler = processor.NewXsltCompiler();
    XsltTransformer transformer = compiler.Compile(sXsl).Load();
 
    XdmNode input = processor.NewDocumentBuilder().Build(xReader); // xReader is an XmlReader object containing XML content to be transformed.
    transformer.InitialContextNode = input;
 
    Serializer serializer = new Serializer();
    MemoryStream memStream = new MemoryStream();
    serializer.SetOutputStream(memStream);
 
    transformer.Run(serializer);
 
    memStream.Position = 0;
    string htmlString = string.Empty;
 
    using(StreamReader reader = new StreamReader(memStream)){
        htmlString = reader.ReadToEnd();
    }
}
 
However, running it yields "exception.Encoding: windows-874 not found" error.
This can be solved by adding the following configuration in web.config:
 
<configuration>
    <appSettings>
        <add value="utf8" key="ikvm:file.encoding" />
    </appSettings>
</configuration>
 
The page (with XSLT 2.0) is now rendered properly.
 
Saxon-B is open-source.
Saxon-SA is a commercial product.
Bookmark and Share

XslCompiledTransform vs. XslTransform - The Performance!

Today I have come across a very nice article about the performance of the XslCompiledTransform (.NET 2.0) vs. XslTransform (Obsolete).
The auther, Anton Lapounov, explained very well how he tested and how to improve the performance.
In conclusion, the XslCompiledTransform takes longer to load but it is much faster when transforming.
This is due to the absence of a native image of System.Data.SqlXml, the assembly where XslCompiledTransform resides, and thus JIT compilation is needed for the first run.
Anton solved this performance issue by NGen-ing it and that significantly reduces the XslCompiledTransform's load time (as well as that of XslTransform's).
 
Please feel free to visit his blog at XslCompiledTransform Slower than XslTransform?
Bookmark and Share

DNN on the Plesk!

The company I am working for has decided to host a website on a hosting with Plesk control panel.
For most websites, without pointing our DNS to this new IP, we can preview the site we create via the plesk sitepreview.
Our website is DotNetNuke-based.
To install DNN on the host, we copied the DNN website downloaded from www.dotnetnuke.com and put it under httpdocs/DotNetNuke directory (accessed via ftp).
We then created a virtual directory with the same name i.e. DotNetNuke and created a database to hold its data.
The connection string can be obtained via the control panel or you can contact the customer service for further assistance if you cannot find it.
To start configuring DNN, we then access the site via sitepreview expecting to see the DNN Wizard start page.However, DotNetNuke doesn't seem to like the sitepreview feature.Whenever we try to access the sitepreview, it redirects us to Godaddy's parking site (we host our domain with Godaddy).
Now what?If we can't access the site, how can we start setting up the DNN?This problem doesn't occur on a local machine since we can access the site directly (not via the Plesk sitepreview).After a few chats with the customer service, we realized that there is a way to fake our machines out to point to the live site IP address without having to go through the sitepreview.Yes! Modifying the hosts file is the solution.
Go to C:\WINDOWS\system32\drivers\etc (I presume that we have installed WINDOWS on c: drive). Or you can type %SYSTEMROOT%\system32\drivers\etc instead. Look for the hosts file named "hosts" (without any extension). Open it in your favorite text editor e.g. Notepad. Add the following lines after 127.0.0.1 line. --> This is why it accesses localhost when we type 127.0.0.1 as a url in the browser.
Please note that our domain is marathonsys.com.
207.176.157.19    marathonsys.com Save it and restart your browser (if opened). Now every time you enter www.marathonsys.com or marathonsys.com in your browser, it will access 207.176.157.19. To access our DNN web site, use http://www.marathonsys.com/dotnetnuke or http://marathonsys.com/dotnetnuke for the url.
 
This is normally used to test our websites on a test server.
But it can also be used in this case :)
 
These settings may need to be removed after we point the DNS to this host. We can either remove the lines or just comment them out by putting a sharp sign (#) at the beginning of the lines as we can see at the beginning of the hosts file that they used it to put some comments in the hosts file.
 
I hope this helps anyone working with DotNetNuke on the Plesk.
Bookmark and Share

Blogumus Tag Cloud with # in the Tag

I've been using Blogumus Tag Cloud for awhile and very impressed with it.
However, since my blog contains many technical posts about C#, there is no doubt that "C#" is one of the tags floating around in Blogumus.
When clicking on the "C#" tag, it shows no result!!!
After messing around, I've found that Clicking on the default Blogger "C#" tag actuallly searches for "C%23" while clicking on the Blogumus "C#" tag searches for "C#".
With this JavaScript put at the beginning of the Blogger template, Blogumus "C#" tag is now (kind of) working properly.
<script language="javascript" type="text/javascript">     var url = document.URL.replace(/\r\n/g,"\n");     var newUrl = url.replace('#', '%23');     if(newUrl != url){         document.location = newUrl;     } </script>
I know it's kinda cheating but, well, it works :P
Bookmark and Share

How To Run Full Screen IE with Toolbar Disabled (Kiosk Mode)

You're going out for a big IT show and letting users - your prospective clients - to enter their information via a website but you don't want them to navigate away freely.
You have tried pressing F11 to get a full screen mode of Internet Explorer but a user can still browse away freely.
Now you realize that you need a full screen mode without that annoying (in this case) toolbar.
What do you do?
  • Keep watching the users to prohibit them to browse around
  • Put a little sign on the top of your monitor telling them not to mess with it
  • Running IE in the kiosk mode
Obviously, you'll need the last option.
To run IE in the kiosk mode, click on the start menu button and click run.
Enter the following command:
iexplore -k [url]
where url is the page you want to IE to browse to.  It's optional.
If url is not specified, it will go to your home page.
Example:
iexplore -k www.stolenbit.com
The only way to exit the kiosk mode is to close IE by pressing Alt + F4.
Pressing Ctrl + O or Ctrl + L will allow you browse to other web sites.
Well, if a user knows these key combinations, he/she can still browse away :P
To quickly get back to your home page, simply press Alt + Home :)
In a big show, I highly suggest that you set the page you want to display as your home page so that you can quickly get back to it after the page is somehow changed (e.g. after submitting information).
Bookmark and Share

Let's Join Google Chrome Dev Channel

Recently, I've found a tool switching Google Chrome's channel from the beta channel to the dev channel.
What does this do?
Well, You get a chance to try the dev build of Google Chrome instead of the beta build that you can download from Google.
Download and run Chrome Channel Switcher
It's pretty small and should take no time to load.
Once running, select the second option: Dev.
When done, select "About Google Chrome" from the wrench button to bring up a dialog box.
It now should look for the latest dev build of Google Chrome.
Install and enjoy :)
If you have encountered any error in the beta build, I highly suggest you to try the dev build.
I was facing a problem when Chrome was trying to load the ScribeFire's InText Ads script.
With this dev build, the problem has now gone :)
Bookmark and Share

Modify the DNN Search Button

Recently, I have a chance to work with DNN skin and containers using PhotoShop files from a designer. So far so good. However, with the latest skin, an image must be used instead of text for the DNN search button (<dnn:SEARCH> control).
First, create a copy of the search user control located under admin/skins and name it "CustomSearch.ascx". Then modify the source code to set custom css classes for the controls inside. The modified code looks something like this:
<%@ Control language="vb" CodeFile="Search.ascx.vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Skins.Controls.Search" %>
<asp:RadioButton ID="optWeb" runat="server" CssClass="SkinObject" GroupName="Search" Text="Web" />
<asp:RadioButton ID="optSite" runat="server" CssClass="SkinObject" GroupName="Search" Text="Site" />
<asp:TextBox id="txtSearch" runat="server" CssClass="SearchTextbox" enableviewstate="False" MaxLength="255"></asp:TextBox>
<asp:LinkButton ID="cmdSearch" Runat="server" CausesValidation="False" CssClass="SearchButton"></asp:LinkButton>
Note that we could have modified the existing Search.ascx but that might affect the whole site since some skins might make use of this default search e.g. the default blue skin.
Notice that it uses a link button as a search button. This will be converted into an <a> HTML tag and thus cannot set an image for it. We need to set it in CSS 9not shown here).
Also notice that the code file is still "Search.ascx.vb". Therefore, I did not change any control's ID just for simplicity and compatibility with the code file. I also assigned "SearchTextbox" and "SearchButton" CSS classes for <asp:Textbox id="txtSearch"> and <asp:LinkButton id="cmdSearch"> accordingly. These CSS classes have been defined in my skin.css under my skin folder. The image for the button has also been set here as a background image.
Now place the CustomSearch.ascx back to admin/skins folder and use <dnn:CUSTOMSEARCH> instead of <dnn:SEARCH> in my skin ascx file. This ALMOST gave me the result I expected. The textbox and image button shows properly BUT there is a text "search" appearing on the search button.
After some investigations in the Search.ascx.vb file, I found that the search text is extracted from a resource file.
In the "Private Members" region, a file name is set as a constant here.
Const MyFileName As String = "Search.ascx"
Under the "Event Handlers" region, a string value has been extracted from a resource file and set as the search text.
Submit = Services.Localization.Localization.GetString("Search", Services.Localization.Localization.GetResourceFile(Me, MyFileName))
.
.
.
cmdSearch.Text = Submit
Now look for "Search.ascx.resx" file under App_LocalResources folder. This file is the resource file that the code calls. Look near the bottom of the file and we see...
<data name="Search.Text"> <value>Search</value> </data>
Bingo! The text that we DON'T want is here. We could just remove the string value but, again, it might affect other skins. So I decided to create another name-value pair and set no value to it.
<data name="SearchNoText.Text"> <value></value> </data>
We could have created another resource file but I don't think it's necessary since adding another name-value pair should work just fine. We will discuss more on this issue in a moment.
Go back to the Search.ascx.vb file and change the line where it gets the string resource to the following:
Submit = Services.Localization.Localization.GetString("SearchNoText", Services.Localization.Localization.GetResourceFile(Me, MyFileName))
.
.
.
cmdSearch.Text = Submit
Save the file as CustomSearch.ascx.vb. Now we have got the code file we want which calls a string value we are looking for (which is a blank). What to do next is to tell the skin to use this code file instead.
<%@ Control language="vb" CodeFile="CustomSearch.ascx.vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Skins.Controls.Search" %>
<asp:RadioButton ID="optWeb" runat="server" CssClass="SkinObject" GroupName="Search" Text="Web" />
<asp:RadioButton ID="optSite" runat="server" CssClass="SkinObject" GroupName="Search" Text="Site" />
<asp:TextBox id="txtSearch" runat="server" CssClass="searchtextbox" enableviewstate="False" MaxLength="255"></asp:TextBox>
<asp:LinkButton ID="cmdSearch" Runat="server" CausesValidation="False" CssClass="searchbutton"></asp:LinkButton>
Now put this skin in use and the search text will no longer be there :)
In conclusion, here is how it gets to the resource string:
CustomSearch.ascx (skin) --> CustomSearch.ascx.vb (code file) --> Search.ascx.resx.
We could have created a another resource file as mentioned earlier. For example, we could create a copy of Search.ascx.resx and name it "CustomSearch.ascx.resx". In this file, we can just remove the value for the data name "Search.Text". The rest remains unchanged. Then in the code file, change the MyFileName constant to "CustomSearch.ascx". This way, the code file will access CustomSearch.ascx.resx to look for the resource string. But, again, there is no need to do that much. Just add another name-value pair and we are ready to go :)
I hope this could give you an idea on how to modify the search module to look the way you want :)
Further Study:
It might be possible to use an image button for the search button and set the id to be the same (cmdSearch). This could also be used to customize the search behavior of the search module. By the way, I am a C# developer, not VB.NET. So, later I will try to create some with C# :)

DNN Tokens

Token

Description

[Portal:Currency]

Currency String

[Portal:Description]

Portal Description

[Portal:Email]

Portal Admin Email

[Portal:FooterText]

Portal Copyright Text

[Portal:HomeDirectory]

Portal (relative) Path of Home Directory

[Portal:LogoFile]

Portal Path to Logo file

[Portal:PortalName]

Portal Name

[Portal:PortalAlias]

Portal URL

[Portal:TimeZoneOffset]

Difference in minutes between Portal default time and UTC

 

 

[User:DisplayName]

User’s Display Name

[User:Email]

User’s Email Address

[User:FirstName]

User’s First Name

[User:FullName]

[deprecated]

[User:LastName]

User’s Last Name

[User:Username]

User’s Login User Name

 

 

[Membership:Approved]

Is User Approved?

[Membership:CreatedDate]

User Signup Date

[Membership:IsOnline]

Is User Currently Online?

 

 

[Profile:property]

Use any default or custom Property defined for user profiles as listed in Profile Property Definition section of Manage User Accounts. Please use non-localized Property titles only.

 

 

[Tab:Description]

Page Description Text for Search Engine

[Tab:EndDate]

Page Display Until Date

[Tab:FullUrl]

Page Full URL

[Tab:IconFile]

Page Relative Path to Icon file

[Tab:KeyWords]

Page Keywords for Search Engine

[Tab:PageHeadText]

Page Header Text

[Tab:StartDate]

Page Display from Date

[Tab:TabName]

Page Name

[Tab:TabPath]

Page Relative Path

[Tab:Title]

Page Title (Window Title)

[Tab:URL]

Page URL

 

 

[Module:Description]

Module Definition Description

[Module:EndDate]

Module Display Until Date

[Module:Footer]

Module Footer Text

[Module:FriendlyName]

Module Definition Name

[Module:Header]

Module Header Text

[Module:HelpUrl]

Module Help URL

[Module:IconFile]

Module Path to Icon File

[Module:ModuleTitle]

Module Title

[Module:PaneName]

Module Name of Pane where UDT resides

[Module:StartDate]

Module Display from Date

 

 

[DateTime:Now]

Current Date and Time

[Ticks:Now]

CPU Tick Count for Current Second

[Ticks:Today]

CPU Tick Count since Midnight

[Ticks:TicksPerDay]

CPU Ticks per Day (for calculations)

For date/time and numeric values, you can also append a "format" string defined by the .Net framework, for example: [DateTime:Now|"format"] current date/time formatted according to "format", e. g. [DateTime:Now|f] displays current date in short format (does not apply to expressions of calculated columns)