Consuming BlogEngine.net RSS

by Idaho Web Designer 29. July 2009 19:52

I have been trying to display my most recent posts on the home page of onecubicleover.com.  I was trying to consume the RSS provided by BlogEngine.Net using ASP.NET and C#.  When I used the code:

DataSet ds = new DataSet();
string blogURL = "http://www.onecubicleover.com/blog/syndication.axd";
XmlTextReader rdr = new XmlTextReader(blogURL);
ds.ReadXml(rdr);
datagrid.DataSource = ds.Tables[2];
datagrid.DataBind();

I get the error "A column named 'title' already belongs to this DataTable" when it reaches the ds.ReadXml(rdr) line.  The problem lies in the syndication.axd file.  The tag <title> is used under <channel> as well as under <item>.  A quick XSLT file and <asp:Xml/> control instead of a datagrid on the default.aspx page was the solution for me.  Here's what I used:

On the default.aspx page I placed:

<asp:Xml runat="server" ID="xml1" TransformSource="XSLTFile.xslt" /> 

On the default.aspx.cs page I used

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Xml.Xsl;
using System.Data;

public partial class _default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Show the latest blog post snippet
        string blogURL = "http://www.onecubicleover.com/blog/syndication.axd";

        XmlDocument rssRead = new XmlDocument();
        rssRead.Load(blogURL);
        xml1.Document = rssRead;

    }
}

And finally my XSLTFile.xslt file:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <table>
      <xsl:for-each select="rss/channel/item">
        <tr>
          <td>
            <xsl:element name="a">
              <xsl:attribute name="href">
                <xsl:value-of select="link"/>
              </xsl:attribute>
              <xsl:value-of select="title"/>
            </xsl:element>
          </td>
        </tr>
      </xsl:for-each>
    </table>
  </xsl:template>
</xsl:stylesheet>

Tags: , , ,

ASP.NET | CSS | RSS

Craze Fun Zone Completed

by Idaho Web Designer 23. July 2009 01:55

I have completed phase 1 of a site for a new client.  Phase 1 of this web site is a simple brochure type web site.  The web site is www.crazefunzone.com.

Craze Fun Zone is a family entertainment facility located on College Avenue in Rexburg, Idaho.  They pretty much gutted and restored the inside of the old IdaMont hotel.  There is a laser tag arena where the old dance hall was.  In keeping with the IdaMont theme, they named their cafe the IdaMont Cafe where they serve Damburgers in honor of the Teton Dam Flood.  Other features of the company are miniature golf, an arcade, and other family entertainment fun.

Future additions to this site will include a photo gallery slideshow of the different areas of this companies business.

Tags:

new site

How to Restore a MySQL DB

by Idaho Web Designer 16. July 2009 18:54

Everytime I go to restore a MySQL database locally that was created from a dump file, I get this error in the GUI interface:

The dump file was not created by MySQL Administrator and could contain unsupported syntax. Hence we cannot restore its content. You can override this behavior by enabling "Ignore errors" on the General page.

Sometimes the "Ignore errors" checkbox has worked, but very rarely. Instead I just restore the database using the command line syntax as follows in a command prompt. Before I run the following, I'll create the database in the GUI and give the user privileges to the database that I want to use to restore.

Navigate to the right directory: C:\cd C:\Program Files\MySQL\MySQL Server 5.0\bin

C:\>mysql -u username -p dbname < restoreFileName

Enter password: ********

Tags:

MySQL

Release of Backcountry Secrets' site redesign

by Idaho Web Designer 10. July 2009 10:18

For the past month a lot of effort has gone in to the site redesign of Backcountry Secrets.  I basically rebuilt this web site from the ground up.  Some of the features of the new site design are faster page load times, a more pleasing graphic design, and more intuitive user interface.  We also added the ability for members to share photos through Flickr, upload and download KML files that are displayed on Google Maps, and submit user reviews.  One new feature that will help with Search Engine Optimization and keeping users on the site longer is the display of "Points Nearby".  These will be internal links and keep users on the site longer looking at related points. 

Tags: , ,

MySQL | new site | ASP.NET | KML | Google Maps | SEO | redesign

Happy 4th of July

by Idaho Web Designer 2. July 2009 16:31

Before I log off for the Holiday weekend and head to Malad for my wife's high school reunion, I just want to wish everyone a Happy 4th of July and say Thank You to those who have served in the military or are currently serving.  I love living in the United States of America and love the Freedom's that we enjoy.  This is truly a land blessed by God. 

Tags:

holiday