Facebook and BlogEngine.NET - Facebook app

by Bobbi Perreault 22. January 2010 22:23
Share on Facebook

I'm still working on integration of Facebook with BlogEngine.NET blogging platform - complete integration.  What I want to happen is this:  If a comment is made on your Facebook note entry - I want that to go over to your blog as well.   If a comment is made on your blog, I want that to go to Facebook.  This is a lot of programming and I'm learning some new concepts in working with Facebook.  It's taking me a long time, sorry.  

I'm actually writing a Facebook application to enable the functionality I want for blog comments.  So in the end, blog subscribers will be able to add your blogging application to their Facebook.  And you will be able to notify all your Facebook subscribers when you have a new post.  Setting up for this in your Facebook account is not a simple thing, so I'll need to provide detailed instructions on how to set up the application when it's ready.
OK.  Back to work.

 

Are You a Foodie?

by Bobbi Perreault 11. July 2008 00:53
Share on FacebookFoodies Unite at FoodDigger

FoodDigger is going live in limited Beta!  I'm privileged to have been able to participate in some small way in the creation of this site and I'm so happy to see it launched. 

If you love good food or just plain want to know where the kind of food you want is to be had at, this is the site for you.  So Sorry, Twin Cities - it's only serving the Greater Los Angeles area for Beta.  I'm working on getting us access for our fair Cities - I know there are many people here who care about what they eat and where they do it at.

The cool thing about the way they do things at this site is that you are able to tell them what kind of food you like and the site will recommend restaurants to you based on that information. 

There's mapping and that gives you your option to find something CLOSE to you that you like.  It's very cool, go on over and give it a whirl.  Use it when you travel to L.A. and please, LET ME KNOW how it worked for you. 

 

Get a Headstart on your Silverlight Project with Subsonic

by Bobbi Perreault 3. July 2008 01:38
Share on Facebook

I'm working on an application with a short development timeline and I needed a tool to generate some code. Since I've been using Subsonic for a few years now, ever since my first Commerce Starter Kit project, it was the natural choice for the job.

It took a few hours to get my templates plugged in to the Subsonic source, but was so worth it. The end result is I've added a template for the Xaml and one for the Xaml code behind, plugged in all the access points for the new templates, and added it to the Website code generator project. Once I pointed that at the database, wala, I just saved many hours of typing.

I use this generated code as a base for a control library, then customize each XAML file together with it's code behind from there. In the project I'm working on, I had immediately 54 controls as soon as I ran the Subsonic Project code generator against my datasource.

Whooo Hooo. I love it. Thanks, Rob and all you others who work so hard on Subsonic.   I am more than happy to share this - my email is bcp@faxt.com and write if you are interested in the code.

Web Sitemap to Google Sitemap Tool

by Bobbi Perreault 3. May 2008 04:03
Share on Facebook

I needed a way to generate a Web Sitemap file from a Google Sitemap file. There's probably a bunch of those around, if you look long enough, you can find anything on the web these days. Ain't life grand? But I wanted my own for a change and it's sometimes just faster to write your own than to learn someone else's style and work within it.

So, since I need to keep the blog active and I needed this tool for a web site I'm managing - I thought I'd just get two things accomplished at once.  Here it is.  The source for this Web Sitemap to Google Sitemap tool is available here.

I started by grabbing this GoogleSitemaps for ASPNET 2.0 program put out by Bertrand Leroy.  To this gift of code, I added a new Handler, called WSiteMap.ashx.  I created a stored procedure that returns from the product, category, manufacturer tables the following three fields: Title, Description, and url.  And I added a class to the AppCode folder of the GoogleSitemaps1.1 program, called GenerateSiteMap.cs

If you use the Commerce Starter Kit or a derivative of it, this Stored Procedure may work for you, otherwise, maybe it'll give you a sample to work off of

create PROCEDURE [dbo].[GoogleSiteMapPagesList]
@baseUrl varchar(255)
as
set nocount on
select [categoryName] as 'title'  ,
        IsNull([shortDescription],'') as [Description],
    @baseUrl + 
    'catalog.aspx?guid='  + convert(varchar(40),categoryGUID) 
        as [url]
from CSK_Store_Category

UNION

select [productName] as 'title'  ,
    IsNull([shortDescription],'') as [Description],
        @baseUrl + 'product.aspx?guid=' + convert(varchar(40),productGUID)  as 'url'
from CSK_Store_Product p where p.isDeleted = 0

Here's the code for GenerateSiteMap.cs

public class GenerateSiteMap
{
    public GenerateSiteMap()
    {
        
    }

    public DataTable createUpdatedList()
    {
        
        SqlConnection sqlconn = new SqlConnection(ConfigurationManager.ConnectionStrings["WebStoreDB_Production"].ConnectionString);
        DataTable dt = executeTableSp(sqlconn, "GoogleSiteMapPagesList");

        return dt;
    }

    private DataTable executeTableSp(SqlConnection connection, string commandText, params SqlParameter[] parameters)
    {

        using (SqlCommand command = new SqlCommand())
        {
            // Initialize the command
            command.Connection = connection;
            command.CommandText = commandText;
            command.CommandType = CommandType.StoredProcedure;

            // Append each parameter to the command
            foreach (SqlParameter parameter in parameters)
            {

                if (!Microsoft.VisualBasic.Information.IsNumeric(parameter.Value))
                {
                    if (parameter.Value is DBNull)
                    {
                        parameter.Value = (object)DBNull.Value;
                    }
                    else
                        parameter.Value = parameter.Value.ToString();
                }
                command.Parameters.Add(parameter);
            }
            try
            {
                connection.Open();
                DataSet oDataSet = new DataSet();
                SqlDataAdapter oAdapter = new SqlDataAdapter(command);
                oAdapter.SelectCommand.CommandTimeout = 1000;

                oAdapter.Fill(oDataSet, "Return");

                return oDataSet.Tables["Return"];
            }
            finally
            {
                connection.Close();
            }
        }
    }


}

And the other piece of code is in WSiteMap.ashx class, it's here:

<%@ WebHandler Language="C#" Class="WSiteMap" %>

using System;
using System.Web;
using System.Data;
using System.Text;
using System.IO;

public class WSiteMap : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        StringBuilder sb = new StringBuilder();
        sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n");
        sb.Append("<siteMap xmlns=\"http://schemas.microsoft.com/AspNet/SiteMap-File-1.0\" >\r\n<siteMapNode>");
        GenerateSiteMap gsm = new GenerateSiteMap();
        DataTable dt = gsm.createUpdatedList();
        foreach (DataRow drow in dt.Rows)
        {
            sb.Append("<siteMapNode ");
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                
                sb.Append(dt.Columns[i]).Append("=\"").Append( removeBreaks( drow[i].ToString() )).Append("\" ");
                               
            }
            sb.Append("/>\r\n");
        }
        sb.Append("</siteMapNode></siteMap>");
        string savepath = context.Server.MapPath(".") + "\\Web.sitemap";
        File.Delete(savepath);
        File.WriteAllText( savepath, sb.ToString());
        context.Response.Write("web.sitemap has been refreshed from the database");
    }
    private string removeBreaks(string cleanit)
    {
        return cleanit.Replace("<BR>"" ").Replace("<Br>","").Replace("<br />"" ").Replace("<br>"" ").Replace("<br >","").Replace("<br/>"" ").Replace("\"""").Replace("&","&amp;") ;
    }
    public bool IsReusable {
        get {
            return false;
        }
    }

}

The process isn't fully automated.  I like to be able to checkover what's going out for Google to index, so I am saving the sitemap manually.  Here are the steps I use when refreshing my sitemap file:

1. Open Default.aspx in your browser, with the connection strings pointed to your database.

2. Click the link to refresh your web sitemap from the databases. 

3. Click the link to view your Google sitemap - it will be displayed onscreen.

4. Save the file as "sitemap.xml".

5. Submit the file to Google using Webmaster Tools.

 

RSS Feed FriendFeed