Chris Hammond

Director of Training Programs for DotNetNuke Corporation

News

Thanks for visiting my blog, you can find more about me at ChrisHammond.com. I am the Director of Training Programs for DotNetNuke Corporation.

Cool Sites

My domains

Projects

DotNetNuke Webinar for Open Source Developers 1/26

Scott Willhite recently announced the following free webinar for open source developers interested in learning more about posting projects in the DotNetNuke Forge.

On Thursday, January 26 at noon PST, Chris Paterra and I will host a free Webinar: A Developers Introduction to the DotNetNuke Forge.

Registration: https://www2.gotomeeting.com/register/589774770

The DotNetNuke Forge is the community repository for open source extensions to the DotNetNuke platform.  Through the Forge your applications can be easily discovered and downloaded directly into any DotNetNuke site. In this webinar we will introduce the capabilities of the DotNetNuke Forge, help you get started and explain why every .Net open source developer should be have a project of their own.

If you are an open source developer and would like to see your work used by others, the DotNetNuke ecosystem is a great destination.  Come and join us, we'll look forward to meeting you and answering any questions you might have.

I’ve got a few of my own projects in there, DNNSimpleArticle and my MultiFunction skin.

Adding a hyperlink to an Image (IMG) with jQuery

While spending a bit of time this weekend working on a new color scheme for ChrisHammond.com I came across the need to be able to add a hyperlink to an image (html IMG tag) using jquery. Why would I want to do that? Well, to be honest I didn’t want to go in and modify the “skin” on my DotNetNuke site, but I did want to create a link on the “HeaderGraphic” image in the skin. Originally that image didn’t link anywhere, now, as I am working on fundraising for the The LIVESTRONG Challenge Davis even on June 24, 2012, I wanted to link that graphic to my “Philanthropy” page.

Doing this in jQuery is rather easy to do assuming you have a way to target the element, in this case I can target the .HeaderGraphic class (part of the MultiFunction skin for DotNetNuke).

Here is the sample code for adding a hyperlink to an image using jQuery.

<script>
    $(document).ready(function(){
        $('.HeaderGraphic').wrap( 
                 $('<a>').attr('href', '/philanthropy.aspx')
        );
    });
</script>

In order to safely embed this into a DotNetNuke page I’ve added it into the Header setting in the Module Settings for one of the modules at the bottom. That particular module is configured to Display On All pages using the module settings.

If you found this code to be help, I ask that you please donate to my cause on the Philanthropy page. Donate what you feel is appropriate.

Part 7: CommunityServer to DotNetNuke handling URLs

So this is Part 7 of my CommunityServer to DotNetNuke blog series, unfortunately it is well over 7 months late, but better late than never I say.

This will be a quick blog post talking about “URLs” and how you can handle the old CommunityServer URLs and redirect them to the proper DotNetNuke URLs. Why would you do this? SEO, bookmarks and existing links. You want people that try to access the CS urls to be redirected properly to the appropriate DotNetNuke URL, be it for a forum post, blog post, or other.

This post isn’t going to cover all the specifics, as there are too many possible variations based on the configuration of your specific website, but hopefully it will provide you an overview of how I handled things in my conversion, and get you on the way to handling them in your conversion.

Previous Posts:
Part 1: An Introduction
Part 2: DotNetNuke Installation
Part 3: Converting users from CommunityServer to DotNetNuke
Part 4: Getting the conversion tables ready for CS  to DNN
Part 5: Moving Forum threads from CommunityServer to DotNetNuke
Part 6: Community Server to DotNetNuke Moving Forum Replies and Attachments.

Assumptions

In order to do what I have done for URL handling you are going to need to purchase the URL Master module from Ifinity, you can find it here on Snowcovered. Without this you are going to have a hard time getting the URLs to work, I am sure it is possible, but I won’t cover that here.

What I ended up doing for the URLs in my conversion was create an HTTPModule that I install into DotNetNuke, and then I tell URLMaster which url formats to ignore and let the HTTPModule handle the redirects for those URLs, I do this through a variety of settings. First let’s cover the HTTPModule.

I also converted “blog” posts from CommunityServer into DNNSimpleArticle articles, I have an importer for that that hasn’t been officially released, but the source can be found on Codeplex as well. I’ll try to do another blog post on using that importer, basically if I remember correctly it requires you to write a simple SQL select statement for your “source” and it will then generate Articles based on the returned results. You can see that in action in the btnSubmit_Click event.

There are a few things in this post that aren’t specific to CommunityServer, but are in for other reasons. Primarily some PHP and CGI handling. I added these in because of “hacks” or attempted hacks from various bots that were hitting the site and throwing 404 errors. I tried to do some redirection on these to pass them to a DNN page rather than letting them die. You can remove/ignore most of those if you like.

CSUrls HTTP Module

I haven’t done an official release for this module, but you can go and grab the source code for the HTTPModule via Codeplex. The HTTPModule uses my standard visual studio template, so you just need to compile the code in Release mode and it will do the packaging for you (into an installable ZIP file).

The HTTPModule is a pretty simple project, there is a .DNN file that controls the installation in DNN, adding the necessary info to the web.config file.

There is also a HttpModule.cs in the Components folder that does all the work. This class could definitely use some refactoring to clean things up, but here is the basic overview of what happens in there.

First we configure a Connectionstring from the DotNetNuke web.config file, and then we create a method to get the PortalId of the existing request, this is necessary within DNN for a variety of methods.

CsRead is the primary method for the class, it does the following.

  1. Gets the PortalId
  2. Grabs the incoming URL
  3. Looks for a csdir querystring parameter that is used in the SiteURLs.config file later to designate when a URL should be parsed by the httpmodule.
  4. Looks for any CS urls that have a Tags querystring (QS) parameter and builds out a link to the DNN Search Results page
  5. Looks for CS Urls that have a PostID QS, based on the PostId we do a lookup from the DNN forum_posts table and build out a URL for that DNN forum thread.
  6. Looks for CS Urls that have a ForumID QS, build a DNN url for the appropriate Forum
  7. Looks for CS Urls that have a GroupID QS, build a DNN url for the appropriate Forum Group
  8. Look for CS Urls that have a PostName QS and then figure out the original CS post ID versus the new DnnSimpleArticle ID, build the corresponding URL
  9. At the end of all this the URL that is built from the previous steps is handled with a 301 redirection, ideally sending the person to the appropriate DNN page (URL).

URLMaster Settings

In order to get URLMaster configured properly I had a lot of trial and error in my configuration, here are the two settings I had to configure on the Host/Friendly URL page.

(useSiteUrlsRegex)

|ShowThread\.aspx|Redirect\.aspx|ShowPost\.aspx|thread/\d+\.aspx|post/\d+\.aspx|ShowForum\.aspx|
/archive/\d{4}/\d{1,2}/\d{1,2}/[a-zA-Z0-9\-\._]*?\.aspx|contact\.php|cgi-bin|forums/rss.aspx

(doNotRedirectRegex)

d+\.aspx|ShowForum\.aspx|/archive/\d{4}/\d{1,2}/\d{1,2}/[a-zA-Z0-9\-\._]*?\.aspx|contact\.php
|cgi-bin|forums/rss.aspx

SiteURLS.config

Here is a list of changes I made to the SiteURLs.config file,

<RewriterRule>
<LookFor>.*/(\d+)/(\d+)/ShowThread.aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;PostID=$2</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/(\d+)/ShowPost.aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;PostID=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/thread/(\d+).aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;PostID=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/post/(\d+).aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;PostID=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/(\d+)/ShowThread.aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;PostID=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/(\d+)/ShowForum.aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;ForumID=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/archive/(\d{4})/(\d{1,2})/(\d{1,2})/([a-zA-Z0-9\-\._]*?)\.aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;PostName=$4</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/tags/([a-zA-Z0-9\-\._]*?)/default.aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;Tags=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/Forums/default.aspx?GroupId=(\d+)</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;GroupId=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/Forums/rss.aspx</LookFor>
<SendTo>~/redirect.aspx?csdir=1&amp;GroupId=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/TabId/(\d+)(.*)/rss.aspx</LookFor>
<SendTo>~/rss.aspx?TabId=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*Telerik.RadUploadProgressHandler.ashx(.*)</LookFor>
<SendTo>~/Telerik.RadUploadProgressHandler.ashx$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>[^?]*/TabId/(\d+)(.*)</LookFor>
<SendTo>~/Default.aspx?TabId=$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*BannerClickThrough.aspx(.*)</LookFor>
<SendTo>~/DesktopModules/Admin/Banners/BannerClickThrough.aspx$1</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/*.php</LookFor>
<SendTo>~/phpredirect.htm</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/cgi-bin/.*</LookFor>
<SendTo>~/cgiredirect.htm</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>.*/*.html</LookFor>
<SendTo>~/cgiredirect.htm</SendTo>
</RewriterRule>

Redirect.aspx

You might notice in the above SiteUrls.config changes I have a reference to redirect.aspx, I did create a simple ASPX file in the root of my website with the following contents. Basically it caught any errors that occurred, and then redirected people to a page I manually created in DotNetNuke called “newsite” that had some messages and links on the page. Basically I wanted to ensure that even if something went wrong, you still got sent to a page that provided information and links to access the new site.

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    {
        try
        {
            
            
        }
        catch
        {
            string href = "http://www.sccaforums.com/newsite.aspx";
            Response.Status = "301 Moved Permanently";
            
            Response.RedirectLocation = href;
            
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>SCCAForums.com</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    </div>
    </form>
</body>
</html>

Old URLs and New URLs

Here is an example of how the Forum URLs work in CS then in DNN.

Forum Thread
CS: www.sccaforums.com/forums/3/372507/ShowThread.aspx
DNN: www.sccaforums.com/forums/forumid/25/postid/41008/scope/posts

I intended to provide an example of how the blog urls worked as well, but in testing it looks like at least on SCCAForums.com the old blog URLs no longer work. I’ll have to track down why that is, I am not TOO concerned about it, but probably should be. The reason I am not too concerned, I do know they worked for a long time, and looking around on Google I can’t find any of the old URLs, so basically Google knows the new URLs and points people there. The problem I would run into is any old links for blogs, within existing blog posts, forum threads, or external sites, probably don’t work.

DotNetNuke Version 06.01.02 Released

Earlier this week DotNetNuke version 06.01.02 was released on DotNetNuke.com (5.6.5 was also released if you are still on DNN5). If you haven’t taken the time to upgrade your website yet, I would encourage you to do so, all of my websites are currently running 6.1.2.

You can typically upgrade to the latest release of DotNetNuke without having to perform upgrades to all previous versions, so for example, if you are on DotNetNuke 5.6.0, you can upgrade directly to 6.1.2, without having to go through each individual upgrade for releases in between.

I always recommend you test upgrades before performing them in production, that being said, I upgraded all of my sites this evening without any trouble, in production Open-mouthed smile

Upgrading DotNetNuke doesn’t have to be hard! The steps are actually very easy, here’s what I do (for more detailed instructions see the Wiki). Some of these steps have videos included as well. (upgrade video from 5.5.0 to 5.5.1, the same steps apply to a 6.1.* upgrade)

  1. Extract the Contents of the ZIP file (unblock on the properties screen first if necessary)
  2. Backup your website’s file system (I just make a copy of the website’s folder)
  3. Backup your database
  4. Place an app_offline.htm file in the root of your website folder to disable the site (video)
  5. Copy the contents of the extracted UPGRADE ZIP file over your existing website.
  6. Remove the app_offline.htm file from the root of your website folder
  7. Access your website in a browser, if you call http://mywebsite/install/install.aspx the upgrade will fire off automatically.

It is that easy. I just performed an upgrade on 8 different DotNetNuke installations (powering over 25 websites) and the upgrades all ran flawlessly.

There are a large number of bug fixes for the release, some of them can be found in Will’s blog post over on DotNetNuke.com

Movember 2011 Results for Team DotNetNuke

Richard EnglishWell another Movember has come and gone, we are now 2+ weeks into December, and I am finally getting the time to get this blog post together. It has been a busy 6 weeks with DotNetNuke World, holidays here in the United States, and planning for 2012 here within the DotNetNuke Corporation.

For those who don’t know what Movember is, it is the Month of November, replaced with Mustaches! Why? To raise awareness about the cancer’s that effect men. The goal is to raise awareness, and of course money, for those organizations that work to fight cancer, primarily LiveStrong and the Prostate Cancer Foundation

We had a number of people working to raise money around the world in the name of DotNetNuke this year, with both a team here in the US and a team based out of Canada, we had employees and community members around the world on those teams.

This year, the two teams raised $2400 for the Movember cause, $1,712 to the US team and the rest to Team Canada. The member who raised the largest amount was Richard English from http://great-webs.com/, a big thanks to Richard for his efforts! You can see his day 30 photo right there in the Day of DNN Nova Scotia t-shirt!

Some of those folks taking part in Movember took a before and after photo, those who sent them both to me are included here in a brief slide show. Our own Brian Vye participated in the month, but doesn’t have a starting photo, I think you’ll be able to pick him out.

Thank you again to everyone who participated in Movember, and those who donated to the cause. I am sure we will do this again in 2012, so start prepping your significant other’s for that! It takes some ground work to grow a mustache for an entire month and not get your neck wrung by family!

Movember 2011 is almost upon us, join Team DotNetNuke

Chris-Hammond-2Dear DotNetNuke Community,

Movember is coming up, and I am getting the DotNetNuke Team going again this year. For those of you who weren’t with the company last year Movember is this. You start with a clean shaven face on November 1st, and grow a mustache (not a beard, not a goatee) for the ENTIRE month, to raise awareness (and money) for cancers that effect men, primarily prostate cancer.

Still not sure what I mean? Check out the video slide show of some of last year’s participants!

Last year DotNetNuke as a company/community raised over $6k dollars, this year I am hoping with a little more effort and community support we can raise $10k. While I was pushing Movember last year, I am far more invested this year as it hits much closer to home now. My father begins treatment for prostate cancer on November 15.

Last year I think we had somewhere around 30-35 team members total, with a company nearing 70 people, we should easily be able to get at least 50 into our DotNetNuke network, plus community members as well. We are doing multiple teams this year, something we didn’t do last year. We have a US team, a Canadian team, and I am hoping we can get a European team going as well. This should make collecting funds easier in the various currencies. All these teams tally up under the DotNetNuke Network on Movember.com.

Getting started with Movember is easy, and fun, here are the steps.

  1. Get permission (if applicable) from your spouse/significant other  to a) Grow a Mustache for the month of November or b) Get your spouse/significant other to grow a mustache as your surrogate. This doesn’t always go over well with wives and girlfriends, husbands or boyfriends so get working on them ASAP!
  2. Join one of the DotNetNuke teams on Movember.com for the US team go to http://bit.ly/dnnmo for the Canadian team go to http://bit.ly/dnnmoca
  3. Spread the word of Movember, when people ask you why you are growing a mustache, BE PROUD let them know about Movember!
  4. Get your friends, family, strangers, etc to donate to the cause! They can easily donate online, and based on the two teams, they can either donate in US$ or that crazy Canadian monopoly money! To have someone donate to the Canadian team use the URL http://bit.ly/donatemoca for the US team http://bit.ly/donatemo 
  5. Send me (chris.hammond@dnncorp.com) a photo of your (or your surrogate’s) clean shaven mug (Face) on November 1st .
  6. Send me a photo of your (or your surrogate’s) Movember mug on 11/15 and 11/30, with your mustache in full grow.

30 Days of Photos Extra Credit:

I am looking for volunteers to post a photo daily, so we can do some 30 day time lapse photos of your mustache growth. If you’re interested in doing that, please follow these directions.

  1. Take a photo every day, preferably in the morning
  2. Try to take the same profile, size, etc, photo each day.
  3. Send them to me each day, I will create the time lapse of the photos at the end of the month

Movember is supposed to be fun, a month of growing a Mustache to raise awareness for cancers that effect men. Proceeds from the campaign go to LiveStrong and the Prostate Cancer Foundation here in the United States, or Prostate Cancer Canada up north.

Learn more about Movember at http://www.movember.com/

Have fun with this!

If you have any questions please let me know!

Now get ready to Grow That Mo!

Chris

Using jQuery in your content to add some flare to your DotNetNuke website

With all of the changes to DotNetNuke 6, a lot can be lost in the fact that you actually maintain the content of your website, and while the maintenance UI has changed, the content that you present is still up to you. A CMS can only do so much for displaying you content, if you want to do some fancy things, branch out of your standard HTML.

I recently wanted to do a couple of things for my car website (yes, I’m a car guy, so it is easy to use the website for examples).

  1. I wanted to have a random image loaded in the top portion of the pages of the website, changing, or randomly loading, on each page load (not rotating live on the page).
  2. I wanted to display a list of recent photos on the home page, and when you click on one of them I wanted them to open up in a light box.

I could have done this in any number of ways, but I chose to implement some simple jQuery for each, below I will show you how.

First things first, the website uses my free DotNetNuke skin, MultiFunction, available via Codeplex. I have some example documentation on how to customize the CSS for the skin to make your site unique, feel free to check out the Documentation page for those examples.

Loading a random image into the header with jQuery

In order to load the random images into the header section of the pages I needed to first create an array of the available photos, I did this just by creating files named hg1, hg2, hg3, etc. I chose to upload these to my bucket on Amazon’s S3, though I just as easily could have used the file manager in DotNetNuke and uploaded them locally to the Portals folder. Because of that, I put the “path” to my Amazon bucket in the javascript, you could change that portion (https://s3.amazonaws.com/dnncdn/p350z/10-16-11/) to your local address, likely something like (/portals/0/images/).

After that I needed to target the CSS for the HeaderGraphic portion of the MultiFunction skin, if you have targeting another element in your HTML you can change that portion in the sample code.

<script type="text/javascript"> 
var images = ['hg1.jpg', 'hg2.jpg', 'hg3.jpg', 'hg4.jpg', 'hg5.jpg', 'hg6.jpg', 'hg7.jpg', 'hg8.jpg']; 
$('.HeaderGraphic').css({'background-image': 'url(https://s3.amazonaws.com/dnncdn/p350z/10-16-11/' + images[Math.floor(Math.random() * images.length)] + ')'});
</script>
 

You can see the code in action by going to www.project350z.com. Refresh the page once you are there and the large image at the top of the page should load something else randomly on the next page load. You can see the jQuery code for this was pretty straight forward, all of 2 lines if you don’t count the opening and closing Script tags.

Pulling in photos from a Photo Group on Flickr and Displaying in a Lightbox

This one is quite a bit more complex to do, though if you have the latest release of MultiFunction v01.01.00 (released Today 10/17/2011) it becomes a bit easier. Within the latest release of the skin I have included a jQuery plugin called OrangeBox, you can find out more about the plugin from the developer http://orangebox.davidpaulhamilton.net/. It is a great little tool for providing LightBox functionality into a website, and not just for photos like I am using it here. It will also embed YouTube videos, you can see a demo of it running on the homepage at http://multifunction.dnndaily.com 

If you aren’t using MultiFunction as your skin, you will need to include some extra information, I will document that later in this post.

I’m using the Razor Host module that comes with DotNetNuke (requires .NET 4.0) for the next section of code, though you could also do the same with the HTML module by switching to the Basic Text mode instead of Rich Text.

In the Razor Host module I have created a new script (I called it latestphotos) in which I have pasted the following HTML/JavaScript code. This code, as you can see inline in the comments, is based off of a post from Richard Shepard, though I made some changes to get things working properly in DotNetNuke.

<script type="text/javascript"> 
// jquery sampled from http://www.richardshepherd.com/how-to-use-jquery-with-a-json-flickr-feed-to-display-photos/
$(document).ready(function(){                    
                           
    $.getJSON("http://api.flickr.com/services/feeds/groups_pool.gne?id=1774215@N20&amp;lang=en-us&amp;format=json&amp;jsoncallback=?", displayImages);
    function displayImages(data) {
 
    var htmlString = "<ul>";
 
        $.each(data.items, function(i,item){
        var sourceSquare = (item.media.m).replace("_m.jpg", "_s.jpg");
        var largeImage = (item.media.m).replace("_m.jpg", "_b.jpg");
        htmlString += '<li><a href="' + largeImage + '" ';
        htmlString += ' rel="lightbox[homepage]" ';
        htmlString += ' data-ob_caption="' + item.title + '"';
        htmlString += ' data-ob_linkText="View on Flickr"';
        htmlString += ' data-ob_link="' + item.link + '"';
    htmlString += ' name="' + item.link + '"';
        htmlString += ' data-ob_share="false"';
 
    htmlString += '>';
        htmlString += '<img title="' + item.title + '" src="' + sourceSquare;
        htmlString += '" alt="'; 
    htmlString += item.title + '" />';
        htmlString += '</a></li>';
    });
 
    $('#p350zimages').html(htmlString + "</ul>");
    $('a[rel*=lightbox]').orangeBox(); 
    
}
    
});
</script> 
 
<div id="p350zimages"> </div> 
 

In that code, you can point to a Photo Group on flickr using the ID for the Group, in this case the Group ID for the Project350z.com group is 1774215@N20. If you want to pull back photos from a specific user, rather than a group, you can use http://api.flickr.com/services/feeds/photos_public.gne?id=17726343@N00&amp;lang=en-us&amp;format=json&amp;jsoncallback=? which currently pulls back photos from my personal stream, changing your User ID (mine is 17726343@N00). You can see the latter at http://www.chrishammond.com

Once you have the OrangeBox plugin referenced on your website (within the MultiFunction skin) you can do things like popup images or YouTube videos into a light box by adding simple HTML code. For example, the homepage of http://multifunction.dnndaily.com uses the following HTML in the “LightBox Examples” section.

<ul>
    <li><a href="http://www.youtube.com/watch?v=H50wW4eAFKo" rel="lightbox">Sample Video</a></li>
    <li>Sample Image <br />
    <a href="/portals/_default/skins/multifunction/home.jpg" rel="lightbox"><img src="http://multifunction.dnndaily.com/portals/_default/skins/multifunction/thumbnail_home.jpg" alt="sampleimage" /></a></li>
</ul>
 

The possibilities here are limitless! So get to it, start adding some flare to your own DotNetNuke website.

UPDATE – Missing CSS

When I originally posted this I left out one bit of CSS out that is necessary for the display I have on Project350z.com. Add this to your portal.css file #p350zimages ul li{display:inline;padding:0 5px 0 0;}

Not using MultiFunction and still want these cool features?

What to do if you aren’t using MultiFunction? You need to add this next line in the same Razor Host script, you should also upload the JS file for the OrangeBox code to your own server and change the URL. You could use the URL here, but I would appreciate it if you used the bandwidth you pay for, instead of the S3 bandwidth I pay for, I may remove that file at some point in time Winking smile

<script src="https://s3.amazonaws.com/dnncdn/js/ob/orangebox.min.js" ></script>

You also need to add the CSS for the OrangeBox plugin to your Portal.CSS file, you can do this via the Site Settings page under the Admin menu. Here is the CSS for the plugin (this is already included in the MultiFunction skin.

/*
 * version: 2.0.3
 * package: OrangeBox
 * author: David Paul Hamilton - http://orangebox.davidpaulhamilton.net
 * copyright: Copyright (c) 2011 David Hamilton / DavidPaulHamilton.net All rights reserved.
 * license: GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */
#ob_overlay {
    background-color:#333;
    display:none;
    height:100%;
    left:0;
    position:fixed;
    top:0;
    width:100%;
    z-index:100;
}
#ob_container {
    height:100%;
    left:0;
    position:absolute;
    top:0;
    width:100%;
    z-index:101;
}
#ob_float {
    float:left;
    height:50%;
    min-width:100%;
}
#ob_window {
    clear:both;
    cursor:default;
    display:none;
    position:relative;
    z-index:102;
    margin:0 auto;
    padding:22px;
}
#ob_content {
    background-color:#fff;
    border:0 solid #fff;
}
#ob_caption {
    color:#333;
    background-color:#fff;
    position:absolute;
    bottom:15%;
    font-size:small;
    max-width:75%;
}
#ob_caption p {
    padding:0;
    margin:10px;
    cursor:text;
}
#ob_window img {
    display:block;
}
#ob_inline {
    padding:20px;
    overflow:auto;
}
#ob_load {
    -moz-border-radius:5px;
    background:url(loading.gif) no-repeat center;
    background-color:#fff;
    border-radius:5px;
    height:40px;
    left:50%;
    position:fixed;
    top:50%;
    width:40px;
    z-index:103;
    margin:-25px 0 0 -25px;
    padding:5px;
}
#ob_error {
    text-align:center;
    width:250px;
    padding:10px;
}
#ob_close {
    background:url(buttons.png);
    cursor:pointer;
    height:30px;
    left:0;
    position:absolute;
    top:0;
    width:30px;
    z-index:1103;
}
#ob_title {
    color:#fff;
    left:auto;
    position:absolute;
    right:22px;
    top:-2px;
    z-index:1103;
}
#ob_title h3 {
    margin:0;
    padding:0;
}
#ob_left,#ob_right {
    bottom:8px;
    cursor:pointer;
    height:100%;
    position:absolute;
    width:75px;
    z-index:1102;
}
#ob_left { left:-53px; }
#ob_right { right:-53px; }
#ob_left-ico,#ob_right-ico {
    cursor:pointer;
    display:block;
    height:30px;
    margin-top:-9px;
    position:absolute;
    top:50%;
    width:30px;
    z-index:1102;
}
#ob_left-ico {
    background:url(buttons.png) center;
    right:10px;
}
#ob_right-ico {
    background:url(buttons.png) right;
    left:10px;
}
#ob_left:hover,#ob_right:hover { visibility:visible; }
#ob_dots {
    list-style:none;
    text-align:center;
    margin:0;
    padding:0;
    width:100%;
}
#ob_dots li {
    height:8px;
    list-style:none;
    width:8px;
    margin:3px;
    -moz-border-radius:4px;
    background-color:#666;
    border-radius:4px;
    cursor:pointer;
    display: -moz-inline-stack;
    display: inline-block;
    zoom:1;
    *display:inline;
}
#ob_dots .current { background-color:#CCC!important; }
#ob_share {
    position:absolute;
    right:24px;
    top:3px;
}
Using request filters in DotNetNuke to restrict website access

Have you ever had the need to blog a range of IP Addresses from accessing your website? Or perhaps, setup a website that is only accessible to a specific range of IP Addresses? DotNetNuke Request Filters are a great tool for getting such functionality configured, all configurable within your browser, without needing access to the settings in IIS.

Before configuring the request filters, I’ll throw out an example of why you might do this. If your website has a forum, or other community type interface, you have likely experienced spammers trying to take advantage of these features. Sometimes these spammers come from a specific IP Address, or even a specific range of ip addresses. If that is the case, you may want to turn off your website for those IP Addresses.

A word of warning, the instructions below are very powerful, if you aren’t careful, you could bring your website down. Read through the instructions before attempting to configure your website’s request filters.

Configuring your DotNetNuke website to be accessible from one IP Address

Here are the steps to configure request filtering for an IP Address, essentially making the website ONLY accessible to a person browsing from a computer using the defined IP address. All other addresses will redirect to DotNetNuke.com. (these instructions assume you are running on DotNetNuke 6+

  1. Login to your website with a Super User account (typically HOST).
  2. Navigate to the Host/Host Settings page.
  3. From there click on the Other Settings tab
  4. Check the Enable Request Filters checkbox
    image
  5. Click on Add New Rule
    image
  6. First we will configure the site to only be accessible from a specific IP Address (67.188.123.23). These settings configure all requests not from 67.188.123.23 to redirect to DotNetNuke.com
    image
  7. To SAVE your new rule, click on the disk icon to the left of the Server Variable field.
  8. If you access the site from the IP Address defined above, the site would function as normal.
  9. If you access the site from a different IP Address than the one defined above, you would be redirected to DotNetNuke.com

Configuring your DotNetNuke website to NOT be accessible from a range of IP Addresses

  1. Login to your website with a Super User account (typically HOST).
  2. Navigate to the Host/Host Settings page.
  3. From there click on the Other Settings tab
  4. Check the Enable Request Filters checkbox
    image
  5. Click on Add New Rule
    image
  6. First we will configure the site to NOT be accessible from a specific IP Address range (67.188.1.1-254). These settings configure all requests from this range to redirect to DotNetNuke.com, all other requests would access the site as normal.
    image
  7. To SAVE your new rule, click on the disk icon to the left of the Server Variable field.
  8. If you access the site from the IP Address in the range defined above, the site would redirect.
  9. If you access the site from a different IP Address than the range defined above, the site would function as normal.

If you are having trouble generating the proper regular expression for a Range of IP Addresses you can check out this page on Google Answers.

If you happen to screw up a rule, and make your site inaccessible, if you can access the file system (either via the server, or FTP) you can find the rules defined in the dotnetnuke.config file in the root of your website.

Be careful if you play around with request filters! They can be very powerful tools.

DotNetNuke World session schedule is up

The schedule for DotNetNuke World has been posted, be sure to check it out and get planning your agendas! Three days of DotNetNuke, tons of great people to talk to, learn from, and lots of stuff to be given away I am sure!

See you in Florida!

http://dotnetnukeworld.dotnetnuke.com/Schedule.aspx

DotNetNuke World is November 9-11 in Orlando Florida, turn it into a family trip and visit some of the local attractions! You can find out more about the Conference at http://dotnetnukeworld.dotnetnuke.com/

Netduino powered tracked vehicle, Part 1

Posted from my personal blog at ChrisHammond.com

A couple of weeks ago I picked up this Tamiya Tracked Vehicle Chassis Kit with the intention of using it with my Netduino. I put it together, but didn’t get around to doing anything with the kit and the Netduino until tonight. Part of the reason I didn’t get it going was the fact that I didn’t have my Adafruit Motor Shield together, I managed to get that completed over the weekend (minus one solder I found that I had missed tonight).

I wasn’t sure where to start with getting the Netduino and the Motor Shield working, so I went to Google, which pointed me to this thread on Netduino.com.

Basically the thread has some sample code that provides a MotorShield class, and a DcMotor class. Because I’m using the tracked vehicle chassis as is, it only has one motor, which means that motor powers both tracks on the vehicle at the same time, so what does that mean? It can pretty much only go forward or backwards, there is no turning in the current setup.

Fortunately I found a Twin Motor Gearbox on Amazon that should work with this setup, one motor for each track, if I can get the code right I should be able to make this beast turn. The best part is I found the gearbox at a local supplier and am picking it up tomorrow afternoon!

Anyways, back to the current configuration. I implemented the code from the linked thread, and made a couple of changes to it, then uploaded it to the Netduino Plus so I could try everything out. I didn’t wire up the chassis/motor at first, I wanted to test it out without the motor to see if I could get any power out of the motor header. I thought I did, so I then plugged in the two wires for the motor into the M4 header on the Motor Shield. Nothing happened, it wouldn’t go forward, it wouldn’t go backward.

Well, it ends up, the Netduino, at least when powered off the USB connection from the PC (haven’t tried it any other way) can’t provide enough power to the motor through the motor shield. I had a simple enough fix, the motor shield has a header for external power, so I took the original power supply from the Tamiya chassis (2 AA batteries) and wired that into the EXT power for the shield. Once I did that I got enough juice for the motor to be controlled by the Netduino.

Here’s a video of the whole rig powering up off the USB connection and starting up.

You will likely notice in the video that there are wires wrapping around the track of the vehicle, and there are wires (blue) sticking out from the shield going to the motor. the netduino/shield and battery pack are loose, just sitting there. This was all just stuck together to see if it worked. If I want this thing to actually run and move around I have a lot of work left to do.

I need to come up with some way to mount the Netduino and the Shield, I need to come up with a better mountable power supply for the shield. I need to get the new gear box/motors in place so I can try to make this thing turn. I also need to come up with a power source for the Netduino, perhaps off the same source for the shield, but I need to read up on how best to do that.

Let me say, this is all really really basic stuff for you hard core hackers, making a motor go forward or backwards, I could do that as soon as I put the chassis together as there was a built in switch included with the kit. I am pretty stoked that I was able to get this going though, I’ve got some ideas on where I want to take this thing, we’ll see if it works out.

Rather than include sample code in this first blog I decided to store all the code in a Codeplex project. In future blog posts I will likely include more sample code. To access the code that I have put together (with the help of this thread on Netduino.com) visit my newly created Codeplex Project "Christoc’s Netduino Samples" (http://christocnetduino.codeplex.com/). Via Codeplex if you want to see the code, go to the Source page of the project.

Stay tuned for more adventures with Netduino.

More Posts Next page »