in

Telligenti

Serving up fresh ideas every day, Telligent style

Scott Watermasysk

May 2008 - Posts

  • Password Limitations

    I am a big fan of 1Password which does a killer job of managing my passwords. In addition to managing passwords, it will also generate new (very) strong passwords when it is time to register for a new site or service. Today, because of either an issue with the Digg password retrieval system or Telligent email spam tools I needed to create a new account on Digg.

    The sign up process is very simple, but I was shocked when I received the follow warning (emphasis is mine):

    Passwords must be at least six characters and can contain only numbers and letters

    Digg Create an Account Step 1

    I do not see why you would ever want to limit users from using stronger passwords. Does this make sense to anyone?


    Posted to Software and tagged as digg , overservations

    Similar Posts

    1. What Software do I use on the Mac?
    2. Unfuddle == BaseCamp For Developers
    3. iPhone vs. BlackBerry

    Posted May 30 2008, 08:35 AM by Simpable
    Filed under:
  • ActiveLinq

    I have been evaluating Linq to SQL and Castle ActiveRecord for a small project I am working on. In end I decided to go with ActiveRecord. As part of my experiment, I did a quick prototype of an ActiveRecord like pattern using Linq to SQL.

    I have zero plans to continue to working on and I cannot stress ActiveRecord like enough. In all honesty, this is an insult to ActiveRecord, but life is too short and there is no reason for this code to die on my hard drive if someone else might find it useful.

    What does it do?

    What it does today is enable very simple querying without the need write more than a line of code. There are some parts like using lambas for the where filter that I really like, but there are others like the order by which feel hacky.

    How to use it?

    1. Add the code files in the download to your project
    2. Take a Linq to SQL class and derive from from ActiveLinq
    3. Register the connectionstring for each type (preferably in App_Start)

    Example:

    [Table(Name = "wc_Users")]public class User : ActiveLinq<User>{ //Columns}

    Then you can use it like this:

    [TestFixture]public class LinqRunner{ [TestFixtureSetUp] public void Init() { ActiveLinqStarter.RegisterTypesByConnectionstring("...", typeof(User)); }  [Test] public void FindFirstUserMatchingCondition() { User u = User.FindFirst(ux => ux.IsEnabled && !ux.IsAdmin, User.OrderByAsc(x => x.Email)); Assert.IsNotNull(u,"user could not be found"); }  [Test] public void FindASingleUserRecord() { User u = User.FindOne(ux => ux.Username == "scottw"); Assert.IsNotNull(u,"user could not be found");  u = User.FindOne(ux => ux.Username == "DOES NOT EXIST"); Assert.IsNull(u, "A user was found when it should not have been"); }  [Test] [ExpectedException(typeof(ArgumentException))] public void FindASingleUserRecordException() { User.FindOne(ux => ux.IsEnabled); //Should return 16 enabled users }  [Test] public void FindAllUserRecords() { var users = User.FindAll(null, null); Assert.IsTrue(users.Count == 17, "Could not find all 17 users"); }  [Test] public void FindAllUserRecordsWithOffset() { var users = User.FindAll(5,20, null, null); Assert.IsTrue(users.Count == 12, "Offset failed, should be 12 uses");  users = User.FindAll(0, 20, ux => ux.IsEnabled); Assert.IsTrue(users.Count == 16, "Could not find all 16 enabled users"); }}

    Download ActiveLinq.


    Posted to Code and tagged as linq , activerecord , source-code

    Similar Posts

    1. Simplifying ASP.Net - NVelocity
    2. Paging Data In ActiveRecord
    3. MvcContrib NVelocity Extension

    Posted May 29 2008, 10:20 AM by Simpable
    Filed under:
  • For Your Convenience

    Maybe it is just me, but this sign seems kind of odd.

    For your convenience

    Is there any other reason? Could it be for someone else's convenience?

    Note to self, no more pictures in a public bathroom.


    Posted to Life and tagged as observations

    Similar Posts

    1. Simplifying ASP.Net - NVelocity
    2. Unfuddle == BaseCamp For Developers
    3. FriendFeed

    Posted May 28 2008, 02:53 PM by Simpable
    Filed under:
  • FriendFeed

    I have had a love/hate relationship with Twitter for a while now. I love how easy Twitter is to use, the connections it builds, and information which can shared. However, I hate that as I become more reliant on it, it seems to never be available. The latest round of downtime has given me the opportunity to explore a couple of other services, in particular, FriendFeed.

    FriendFeed enables you to keep up-to-date on the web pages, photos, videos and music that your friends and family are sharing. It offers a unique way to discover and discuss information among friends

    I had created an account on FriendFeed a couple of weeks ago, but similar to Twitter I really did not give it much time at first since without other users, it is really just an opportunity to talk to myself in public. However, over the last couple of days I have found myself using FriendFeed a lot more.

    Here is a quick list of some of the things I am liking about the service:

    • It is online. OK, this is a cheap shot, but I have yet to have any issues connecting to the site, paging, etc. We will have to see how well they scale overtime.
    • Rooms - FriendFeed rooms are a simple way/place for people to get together and discuss a particular topic/idea/etc. I created a couple of Rooms for Graffiti and Community Server
    • Conversations - It is much easier to have a conversation with a group of people than compared to Twitter. FriendFeed supports true comments.
    • Ignoring Conversations - it is much easier to ignore a conversation I am not interested in. On Twitter if two are three of the people you following start posting like crazy on a particular topic it is not really possible to opt out of the conversation.
    • Other Services - FriendFeed makes is very easy to share additional content from your blog (really any RSS feed), Tumblr, YouTube, Flickr, etc
    • Twitter - I do not have to give up on Twitter cold turkey. All of the messages from the people I am following show up up on FriendFeed.
    • Twitter Replies - The overall twitter integration could be a little tighter, but with the comment feature above they make it very easy to send your replies back to twitter.
    • Likes - FriendFeed makes it very easy to flag items you like (similar to Twitter), but they take it up a notch by sharing that information with your friends/followers.

    So what's not to love?

    • Delays - The site itself is very responsive. However, since it is pulling content from a variety of sources there is noticeable delay between when it is published and when it displayed on FriendFeed. This is not always a problem, but I still find myself making regular posts on Twitter since it shows up immediately to a wider audience.
    • Numbers - Since it is relatively new, FriendFeed simply does not have as many users a Twitter. I think this will change shortly, but it is still much easier to broadcast your message to a wider audience on Twitter.

    If you decide to create an account, you can subscribe to my feed at http://friendfeed.com/scottwater.


    Posted to Software and tagged as friendfeed , twitter

    Similar Posts

    1. What Software do I use on the Mac?
    2. iPhone vs. BlackBerry
    3. Unfuddle == BaseCamp For Developers

    Posted May 27 2008, 07:48 AM by Simpable
    Filed under:
  • Paging Data In ActiveRecord

    I am still digging Castle's ActiveRecord implementation. While the code is "tight" and there is substantial documentation, there are still a couple of things that took me longer to figure out than I had hoped. This is not a knock against Castle, more a testament to the size and scope of the project. Anyway, here are a couple of notes on paging data.

    Three things I learned about paging data in ActiveRecord (via NHibernate)

    1. Writing a query that pages is very easy. There is a set of queries in the Castle.ActiveRecord.Queries namespace which all have an overloaded method SetQueryRange. The first overload takes a single integer which sets the max results. The second sets both the number of results you need and an offset.

    var userQuery = new SimpleQuery<User> ("from User where IsEnabled = :IsEnabled Order By Username");userQuery.SetParameter("IsEnabled", true);userQuery.SetQueryRange(pageIndex * pageSize, pageSize);

    2. Paging can be done without the use of the Queries namespace via the SliceFindAll static method on ActiveRecordBase. In hindsight this is pretty obvious, but I completely missed this method initially and went with the queries above.

    public static T[] SlicedFindAll(int firstResult, int maxResults, params ICriterion[] criteria) public static T[] SlicedFindAll(int firstResult, int maxResults, Order[] orders, params ICriterion[] criteria)  public static T[] SlicedFindAll(int firstResult, int maxResults, DetachedCriteria criteria, params Order[] orders)

    For example, in my project, if I wanted to get the fourth page (10 per page) of users ordered by Username and filtered by IsEnabled = true:

    var userList = User.SlicedFindAll(30, 10, new Order[] {new Order("Username", true)}, Expression.Eq("IsEnabled", true));

    3. If you need to page large sets of data and you need to use SQL Server 2000, ActiveRecord (and NHibernate) are not the correct tool. The NHiberate SQL 2000 dialect does not (completely) filter the number of records in the database. It does attempt to limit the results, but ultimately if you request page 4 at 10 records per page, 50 records will be returned from the database. Since an entity does not have to equal a table, I kind of understand why this is the way it is, but it still sucks. Of course the good news is most people are now using SQL Server 2005 and although SQL Server 2005 does not support limit/offset like MySQL, a CTE is used in the 2005 dialect and a limited number of records is returned.


    Posted to Code and tagged as activerecord , castle

    Similar Posts

    1. MvcContrib NVelocity Extension
    2. iPhone vs. BlackBerry
    3. X-Copy Database Options

    Posted May 19 2008, 11:55 AM by Simpable
    Filed under:
  • Enhancing Desktop Computing with the Cloud

    There is a lot of (rightfully so) hype around cloud computing and web based tools. One area, that I find very interesting which gets very little coverage is desktop computing with support in the cloud. There are three tools that I use all the time which marry a desktop experience which is enhanced in the cloud.

    Three Great Tools

    Evernote - (Mac & PC) "Evernote allows you to easily capture information in any environment using whatever device or platform you find most convenient, and makes this information accessible and searchable at anytime, from anywhere". I primarily enter notes on my MBP, but since it will sync itself across multiple devices it is very to retrieve those notes when I am on a PC. In addition, there is a web based access and a new iPhone specific interface. What really sets Evernote apart from other software (OneNote) are the options for adding notes (dragging images, printing directly to it, copy and paste with images). In addition, if making your content accessible wasn't enough, images are processed with OCR. What this means is that when you do a search you are not only searching text, but potentially text from your images. Video Overview.

    Skitch - (Mac only) "Skitch.com is a webservice that works hand in hand with our application Skitch to give you 1-click uploading of images for fast and fun image sharing". I have mentioned Skitch before. This tool just rocks and of the three tools I am writing about today, it is the one I would be totally lost without. It makes it so simple and easy to share an a screenshot/picture/image I am not sure what I would do without. And of course, it works flawlessly with Evernote. Video Overview.

    Jing - (Mac & PC) Jing allows you in an effortless way capture images and video of your desktop and share them with the world (or privately). Since I am a Skitch fan, I do not use the image sharing often, but the video feature has become an integral part of our software development process. Video Overview

    One Annoying Thing

    There is one thing these three tools/services have in common that annoys the hell out of me. All of them are currently in beta and free to use. I fully expect they will all at some point charge for their software and services. I have zero problems paying for great software, especially for software I find as useful as these three tools. However, all three of the companies behind these tools have been very quite about their future intentions. I suspect all three will be reasonably priced, but it definitely worries me to have such a personal dependency on something without a known cost.

    You?

    Are there any other tools you are using? If so, please let me know in the comments.


    Posted to Software and tagged as mac , jing , evernote , skittish , cloud

    Similar Posts

    1. iPhone vs. BlackBerry
    2. What Software do I use on the Mac?
    3. Life on a Mac - Five Months Later

    Posted May 15 2008, 08:30 AM by Simpable
    Filed under:
  • Developer Choice

    This post initially started as a set of notes related to my own research around NHibernate and Linq to SQL. However, it quickly turned into a very obvious "ah ha" moment.

    As I have previously mentioned, I have been doing a lot of research lately on various tools. One area I have focused on recently is data access. This is an area of hot debate for many people and can easily turn into a pissing match, so I first want to share my key take away:

    The tool in itself, does not matter. It is all about what you are comfortable with.

    In hindsight, this is very obvious. It is generally the answer to most developer questions (C# vs. VB, SQL Server vs. MySQL, ASP.Net vs. Rails). There will always be trade offs. The result will never be perfect.

    This of course does not mean you shouldn't try anything new. The world of software is in constant flux. I routinely cringe at code I wrote a year ago. However, if you spend all your time looking for the perfect solution, you won't leave yourself the necessary time to build something great.

    FYI, if you are still interested in the NHibernate vs Linq to SQL, here is a nice overview by Geoff Bennet.


    Posted to Code and tagged as nhiberate , linq , active-record

    Similar Posts

    1. X-Copy Database Options
    2. Introductions
    3. Graffiti v. Wordpress - Part II

    Posted May 14 2008, 09:03 AM by Simpable
    Filed under:
  • MvcContrib NVelocity Extension

    One of the major selling points of ASP.Net MVC is its extensibility options. Almost every piece of it can updated or swapped out. I have been hacking on the bits quite a bit over the last couple of weeks and have been using the MvcContrib to augment some of the built in ASP.Net functionality.

    The main piece of MvcContrib I have been using is it's NVelocity view engine. As I previously mentioned, I personally find NVelocity much easier to work with than standard aspx pages.

    One of the features I had previously leveraged in NVelocity was the concept of a Toolbox. A toolbox, as the name implies is a collection of objects you can build to make building views easier and a little more DRY. Previously I have done this via a configuration file, attributes (Graffiti Chalk Extensions), or by simply adding items to the NVelocity context.

    Adding support to access the NVelocity context would have been pretty easy, but it would have worked against one of the tenants of MVC, separation of concerns. I could have also just sub-classed the base controller and added my tools to ViewData dictionary, but again I would abusing the separation of concerns by introducing a dependency between my views and controllers.

    So now I needed to find a (simple) way to add my toolbox items without building a dependency between my controllers and views. I had already been using Castle Windsor to manage other dependencies in my project, so with a little trial and error (and some documentation reading) I was able to add optional support for injecting one or more IToolbox instances directly into my view factory which in turn, exposes them to my views. 

    Unfortunately, I could not figure out a clean was to extend the NVelocityViewFactory, so I took the easy way out and just copied and pasted the code into my own project. [Note: If others find this helpful, I will see if I can get it committed to the main project].

    Once I copied NVelocityViewFactory.cs, the changes I needed to make were very trivial.

    First, I created an interface called IToolbox with a single property to implement, Key. Key is used to expose the IToolbox object to the NVelocity view (ie, $key.ToolboxPropertyOrMethod).

    public interface IToolbox{ string Key { get; }}

    Example:

    public class MathTool : IToolbox{ public string Key { get { return "math"; } }  public int Add(int x, int y) { return x + y; }  public int Subtract(int x, int y) { return x - y; }}

    Next, I added a new constructor to the NVelocityViewFactory class which accepted an array of IToolbox as well as one which accepted an array of IToolbox and the standard IDictionary which was already in place.

    Finally, I updated a copy of the NVelocityView class to work with and properly pass along the array of IToolbox.

    You can download the code and add it to your project. To use it, simply wire up the NVelocityViewFactory via Windsor and then configure it to pass along your own IToolbox items as an array.

    <?xml version="1.0" encoding="utf-8" ?><configuration> <components>  <component id="ViewFactory" service="System.Web.Mvc.IViewEngine, System.Web.MVC" type="WaterCooler.Web.MVC.NVelocityViewFactory, WaterCooler.Web">  <parameters> <tools> <array> <item>${ToolBox.DateTool}</item> <item>${ToolBox.MathTool}</item> </array> </tools> </parameters>  </component>  <component id="ToolBox.DateTool" service ="WaterCooler.Web.MVC.IToolbox, WaterCooler.Web" type="WaterCooler.Web.MVC.DateTool, WaterCooler.Web" />  <component id="ToolBox.MathTool" service ="WaterCooler.Web.MVC.IToolbox, WaterCooler.Web" type="WaterCooler.Web.MVC.MathTool, WaterCooler.Web" /> </components></configuration>

    And that should be it. Now as you create a new IToolbox, you can quickly and easily inject them to your views.

    Download.


    Posted to Code and tagged as mvc , nvelocity , open-source

    Similar Posts

    1. Simplifying ASP.Net - NVelocity
    2. Unfuddle == BaseCamp For Developers
    3. iPhone vs. BlackBerry

    Posted May 13 2008, 10:07 AM by Simpable
    Filed under:
  • Simplifying ASP.Net - NVelocity

    NVelocity[1] is a .NET port of the Velocity open source template engine. I have used NVelocity quite a few times over the last couple of years.

    • CSBTL - this project never went public, but basically it removed the need to understand web forums and complicated server controls for building Community Server blog themes.
    • Graffiti - Graffiti supports a very simple theming model which enables building new themes with no knowledge of web forms and/or ASP.Net

    While you have more options using aspx pages, I generally prefer the simplicity of doing web pages via NVelocity. There are no complicated server controls, complete control over the markup, simple extensibility, and no need to jump between contexts when iterating over a list.

    With this in mind, I was very happy to find the NVelocityViewFactory as part of the MvcContrib project. With just a couple configuration steps, I was able to use NVelocity views for my ASP.Net MVC projects. Sweetness!

    For example, Phil Haack, has a post which discusses options to doing a simple repeater. This could be greatly simplified with NVelocity (see below). No code needs to be written, no context switching for properties, etc.

    <table>#foreach($hobby in $hobbies) <tr class="#if($velocityCount % 2 == 0)row #else alt-row #end"> <td>$hobby.Title</td> </tr>#end</table>

    In addition, using fancy loops we could easily add content to be shown if it is empty and better structure our markup.

    #foreach($hobby in $hobbies)#beforeall <table>#before <tr class=#even "row">#odd "alt-row">#each <td>$hobby.Title</td> #after </tr>#afterall </table>#nodata <h3>Sorry, no hobbies</h3>#end

    The above example takes it to the extreme (all parts are optional), but should give you an indication of power available to you, again, all without requiring you to write a single line of code.

    [1] As mentioned on the Castle site, the original NVelocity project seems to be dead. I have been using the updated version of Castle and recommend you use this version as well.


    Posted to Code and tagged as nvelocity , open-source , mvc , castle , graffiti , cs

    Similar Posts

    1. Castle Project
    2. Unfuddle == BaseCamp For Developers
    3. What Software do I use on the Mac?

    Posted May 12 2008, 04:53 PM by Simpable
    Filed under:
  • Telligent Hack-A-Thon II

    We had our second Telligent Hack-A-Thon last week when the product team was in town to celebrate the release of Community Server 2008.

    The objective was pretty simple: Create something useful using the new Community Server 2008 web service layer in about 20 hours. Sleep was optional.

    The team did some amazing work (videos). It will take us a couple of weeks, but we are working on a site to host the code/samples/videos from this hack-a-thon and other similar internal events. Maybe we should do a public event or two?


    Posted to Code and tagged as cs , web-services , hat

    Similar Posts

    1. SharePoint Developer
    2. Community Server 2008 Beta 1
    3. Community Server 2008 Is A Live!

    Posted May 09 2008, 10:53 AM by Simpable
    Filed under:
  • Castle Project

    Castleinabox For the last couple of weeks I have been digging through a bunch of new projects/concepts with the hope of using some new (to me) things in a couple application samples/prototypes I am itching to build. One of the projects I have been spending a lot of time with recently is the Castle Project.

    From the site:

    Castle is an open source project for .net that aspires to simplify the development of enterprise and web applications. Offering a set of tools (working together or independently) and integration with others open source projects, Castle helps you get more done with less code and in less time.

    For the longest time, I mistakenly assumed Castle was just Monrail. I was very wrong. There is a lot of great things in this project that you can easily leverage when building your own solutions...even if you could care less about MVC/Monrail.

    My Favorites:

    • ActiveRecord: "The enterprise data mapping pattern implemented using NHibernate". In a nutshell it makes the power of NHibernate extremly accessible with almost zero effort.
    • Windsor Container Entperise grade inversion of control container. I have written a lot of plugin/extensibility code in the last couple of years which could have dramatically simplified and reduced with Windsor.
    • Validators A light weight validation framework. There is a nice example of integrating it with LiveValidation and using it with ASP.Net MVC.

    There is actually quite a bit more there as well. The funny thing is I have been using Castle's updated version of NVelocity for quite a while and never really bothered to look around much until recently. If you are unfamiliar with the project, I definitely recommend taking a peak. I am sure you will find something which will help you on a future project.


    Posted to Code and tagged as castle , open-source

    Similar Posts

    1. Graffiti CMS FAQ
    2. Unfuddle == BaseCamp For Developers
    3. ASP.Net MVC - A Step Towards A More Simple ASP.Net?

    Posted May 08 2008, 11:04 PM by Simpable
    Filed under:
  • Telligent Product Team Openings

    There are two new openings on the Telligent product team. If you are in the Dallas area and have a passion for building great software, see the listings below.

    The open stops are focused on some of our most pressing areas, but we are always looking for great people. If the two areas above don't excite you but you still are still interested in product development at Telligent feel free to drop us a line.


    Posted to Business and tagged as telligent , jobs

    Similar Posts

    1. SharePoint Developer
    2. 1000 Lines Of Code
    3. Unfuddle == BaseCamp For Developers

    Posted May 08 2008, 04:00 PM by Simpable
    Filed under:
  • Alex's Lemonade

    A couple of weeks ago, I got an invitation to my college roommate's son's first birthday. Normally, that would not be worthy of a blog post, but there was something in the card I was not expecting.

    Inside the card, was a piece of paper with the following:

    In lieu of gifts for **** first birthday, we are asking our guests to make a donation to Alex's Lemonade Stand to help fight against childhood cancer.

    About Alex's Lemonade Stand

    In 2000, a 4 year old cancer patient named Alexandra "Alex" Scott announced a seemingly simple idea -she was holding a lemonade stand to raise money to help "her doctors" find a cure for kids with cancer. The idea was put into action by Alex and her older brother, Patrick, when they set up the first "Alex's Lemonade Stand for Childhood Cancer" on their front lawn in July of 2000.

    For the next four years, despite her deteriorating health, Alex held an annual lemonade stand to raise money for childhood cancer research. Following her inspirational example, thousands of lemonade stands and other fundraising events have been held across the country by children, schools, businesses, and organizations, all to benefit Alex's Lemonade Stand Foundation for childhood cancer. On August 1st, 2004, Alex died peacefully at the age of 8 -- she had raised over $1 million for childhood cancer research in her short lifetime.

    I had actually read about Alex's Lemonade stand in the past, but for whatever reason never made a donation. In the last couple of years, we have attended many children's birthday parties. All have been fun celebrations, but this will be first where we are not only celebrating another year of life for the birthday boy, but also helping another child hopefully live another year.

    Having a 10 month old daughter certainly makes this particularly charity stand out, but there are lots of other great charities out there. Do yourself a favor, take a couple of minutes and make a quick donation. It will be a great way to start your morning.


    Posted to Life and tagged as cancer , donations

    Similar Posts

    1. iPhone vs. BlackBerry
    2. Life on a Mac - Five Months Later
    3. What Software do I use on the Mac?

    Posted May 08 2008, 10:54 AM by Simpable
    Filed under:
Powered by Community Server (Commercial Edition), by Telligent Systems