Tech Geek Fun Photos from 2009

by Al Bsharah | 02.21.2010 10:52 AM | Comments (0)

It's rare that I post anything personal related, but I decided today to share some random Tech, Geek, Fun, or whatever-related photos that I took in 2009.  See?  It's sort-of business and/or technical in nature! 

You can watch via slide-show, or view them one at a time below.  I also included something extra that makes me (for some strange reason) laugh uncontrollably.  It's a YouTube video at the end of this post.

 

Share | | |

A Better Twitter Widget for BlogEngine.NET 1.6

by Al Bsharah | 02.02.2010 10:04 PM | Comments (12)

UPDATE 05/01/2010:  Per Donovan Olivier's Suggestion, I've updated this widget to fix a problem in displaying Twitter usernames with an underscore in them.  Thanks Donovan!

I made some tweaks today to the new Twitter Widget that was released with BlogEngine.NET 1.6.  I noticed that @User and #Hash tags were not linked up, so I fixed that.

Below is the code you need to modify.  Any GREEN code is new, any BLACK code is code that was already there.  Should be pretty easy to cut/paste it in place.

Option #1: Download the version 1.1 widget.ascx.cs-v1.1.zip (2.90 kb) file directly, drop it into your site, refresh.

Option #2: Make the following changes in the file: <root>/Widgets/Twitter/widget.ascx.cs:

Comment this out, or remove it all-together:

//if (title.Contains("@"))
//    continue;

Add the two lines shown here:

twit.Title = ResolveLinks(title);
twit.Title = ResolveUserLinks(twit.Title);
twit.Title = ResolveHashLinks(twit.Title);

Add the green lines below:

    //URL
    private static readonly Regex regex = new Regex("((http://|https://|www\\.)([A-Z0-9.\\-]{1,})\\.[0-9A-Z?;~&\\(\\)#,=\\-_\\./\\+]{2,})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
    private const string link = "<a href=\"{0}{1}\" rel=\"nofollow\">{1}</a>";
    //@User
    private static readonly Regex regex2 = new Regex("@[a-zA-Z0-9_]*", RegexOptions.Compiled | RegexOptions.IgnoreCase);
    private const string link2 = "<a href=\"{0}{1}\" rel=\"nofollow\">{2}</a>";
    //#Hash
    private static readonly Regex regex3 = new Regex("#[a-zA-Z0-9]*", RegexOptions.Compiled | RegexOptions.IgnoreCase);
    private const string link3 = "<a href=\"{0}{1}\" rel=\"nofollow\">{2}</a>";

Add the two green functions below:

    /// <summary>
    /// The event handler that is triggered every time a comment is served to a client.
    /// </summary>
    private string ResolveLinks(string body)
    {
        return regex.Replace(body, new MatchEvaluator(Evaluator));
    }
    private string ResolveUserLinks(string body)
    {
        return regex2.Replace(body, new MatchEvaluator(EvaluatorUser));       
    }
    private string ResolveHashLinks(string body)
    {
        return regex3.Replace(body, new MatchEvaluator(EvaluatorHash));
    }

    /// <summary>
    /// Evaluates the replacement for each link match.
    /// </summary>
    public string Evaluator(Match match)
    {
        CultureInfo info = CultureInfo.InvariantCulture;
        if (!match.Value.Contains("://"))
        {
            return string.Format(info, link, "
http://", match.Value);
        }
        else
        {
            return string.Format(info, link, string.Empty, match.Value);
        }
    }
    /// <summary>
    /// Evaluates the replacement for each @User link match.
    /// </summary>   
    public string EvaluatorUser(Match match)
    {
        CultureInfo info = CultureInfo.InvariantCulture;
        String user = Regex.Replace(match.Value, "@", "");
        return string.Format(info, link2, "
http://twitter.com/", user, match.Value);
    }
    /// <summary>
    /// Evaluates the replacement for each #Hash link match.
    /// </summary>   
    public string EvaluatorHash(Match match)
    {
        CultureInfo info = CultureInfo.InvariantCulture;
        String linktag = Regex.Replace(match.Value, "#", "%23");
        return string.Format(info, link3, "
http://search.twitter.com/search?q=", linktag, match.Value);
    }

And that should do it!

Share | | |

Categories: Development

Tags: , , , ,

BlogEngine 1.6 Released – Quick Start Help Guide

by Al Bsharah | 02.02.2010 10:34 AM | Comments (8)

BlogEngineLogoBlogEngine 1.6 was just released with substantial SPAM Filtering and Comment Management upgrades.  As well, a number of bug fixes and other new features have been included such as Multiple Widget Zones.

You should follow this upgrade process, but I’ve also added my own summary of the steps I took below.

  1. Make a backup!
  2. Copy your live web to a test web, if you have the ability to test on another URL.
  3. Download the 1.6 files on top of the 1.5 installation.
  4. Delete the ExtensionsManager folder.
  5. Change permissions on App_Data and Web.Config.
  6. If you were using Akismet before, delete the Akismet Extension (leave the new AkismetFilter Extension)
  7. Copy your original 1.5 .xml files from the App_Data folder back into the new 1.6 folder, but take care not to overwrite or delete anything new that was added.  Additionally, make sure you MERGE the settings.xml file as there were additional settings added.  The bottom line on this step?  Analyze the directories and file data to assure you're not losing anything that was added in (and required for) 1.6.
  8. Recycle or restart the web site
  9. Log in
  10. Go to the Extensions admin tab
  11. Disable the “Commentor” Extension if you were using it before (it’s now a part of the core)
  12. Enable the AkismetFilter Extension (if you were using Akismet before, make sure to enter your account information)
  13. Go to the Comments admin tab
  14. Under the Configuration sub-tab, update your settings the way you wish!
  15. Test your theme and other settings thoroughly (make sure you check your CSS in the upgrade process provided by the BE folks)
  16. If all’s well, copy the temporary site to your live site and re-test!

Enjoy the new system.  I’m curious to see if I’ll need to re-add the CAPTCHA Solution, or if this new build will mitigate most SPAM. 

How has your upgrade gone?

Share | | |

RecentComments

Comment RSS

Calendar

<<  July 2010  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Tag cloud