Jacksonville Developers User Group

Learn new things...write better code.
Welcome to Jacksonville Developers User Group Sign in | Join | Help
in
Home Blogs Forums

Jonathan Bates

  • November 12th - RubyJax Meeting

    RubyJax's next meeting is Wednesday, November 12th.  If you are looking for something a little different from JaxDUG, or just to meet some other member of the developer community, check it out.
  • November 13th - JaxFusion Meeting

    Originally reported here, the next JaxFusion meeting (on Ext Javascript Framework) has moved to Thursday, November 13th, so as to not conflict with the Refresh Jacksonville meeting on Tuesday, November 11th, reported here.

    Its a great week for Javascript developers in the community.  Go out and catch a meeting.

  • And the new President is . . .

    Its nice to see this week that we were able to witness another bloodless transfer of power from one administration to the next.  I am not referring to the 2008 U.S. Presidential Election, but the recent JaxDUG Election.

    I had announced recently that I would be ending my reign of terror as JaxDUG president.  That clarion call was answered by Bayer White and Adam Lowe, both excellent and qualified candidates. As the run-up to the night came, the two of them found a way to work it out amongst themselves.  Adam decided to bow out of the race, make Bayer president by virtue of being the only choice.  Bayer then decided to make Adam his vice president.

    I congratulate both and wish them the best of luck.  I think we should all look for exciting changes from the two of them in the coming months and beyond.

  • November 11th - JaxFusion meeting

    David Fekke of Jacksonville's Cold Fusion group, JaxFusion, is having a meeting November 11th.  Steve Gustafson of JobWire will present on the Ext Javascript UI Framework.  All the details at http://www.jaxfusion.org/meeting.cfm
  • November 11th - Refresh Jax - Object Oriented Javascript

    November 11th sees the return of Refresh Jacksonville with Donald Sipe's presentation Writing Object Oriented Javascript.  Seems like a great topic that you are not going to want to miss.  All details can be found at the Refresh Jacksonville site.
  • Will Reed to present Website Performance Tips and Tricks at RubyJax 10/29

    I have mentioned Will before, and he'll be doing his thing again at RubyJax this week.  You can get all the available details here.
  • Why Software Projects Fail

    We all know the reasons for this (not enough bagels and good coffee stocked in the break room), but its great to have a picture.  I picture is, after all, worth a thousand words.  Of course in today's economy, a thousand words isn't worth what it was.

    Check out http://www.codediesel.com/visualization/why-software-projects-fail-poster/

  • Silverlight 2 Released

    From Scott Guthrie's blog, Silverlight 2 has officially been released, as well as tools to work with Visual Studio 2008 SP1 and Expression Blend SP1.

    Additionally, Karl Shifflett (of fame and acclaim in the WPF world) has PowerToys for Silverlight to make your Silverlight / XAML / WPF developer experience that much more fun.  It allows you to easily render some cool stuff for users, too.

  • HTML script tags must have a closing script tag

    I was going to title this, "New Ways I Discover I Am An Embarrassing DumbAss", but here goes. . .

    I was working on something, and importing a JavaScript library.  I was referencing it from a master page, in the head section, all was hearts and flowers.  I decided I was going to add in a plugin and I added in a line for that script and some accompanying CSS.  Hearts are broken, flowers dead.

    I start to bang a soft spot in my head trying to figure this out.  Its funny how something that should work just doesn't and your entire world view is shattered.  I switched from IE7 to FireFox3.  Still no love.  No joy in Safari.  On a lark I try Chrome, and it does work as expected.  Now I am more confused, not less.

    Going back to FF3, I look at the page via FireBug, and lo, there is the issue.  Only one of my imported scripts is being imported.  The problem?  I didn't close the <script> element with a </script>, so I was doing this:

    <script src="./js/jquery-1.2.3.js" type="text/javascript" />

    instead of this:

    <script src="./js/jquery-1.2.3.js" type="text/javascript"></script>

    So why would that be an issue?  If I had to guess, I'd say it has to do with the src attribute.  From the W3C:

    The script may be defined within the contents of the SCRIPT element or in an external file. If the src attribute is not set, user agents must interpret the contents of the element as the script. If the src has a URI value, user agents must ignore the element's contents and retrieve the script via the URI. Note that the charset attribute refers to the character encoding of the script designated by the src attribute; it does not concern the content of the SCRIPT element.

    So because its designed to get something from its own contents or from an external URI, the closing tag would need to be there for those cases when there are contents. I guess its just easier to work with knowing it always has a closing tag instead of holding two different parsing rules based on the src attribute.

  • LINQ to SQL: Returning Multiple Result Sets From Stored Procedures

    I have been goofing with LINQ for awhile but have gotten the opportunity very recently to really start to get my feet wet with it.  As I was demonstrating some of it to another developer yesterday, he asked about stored procedures and if LINQ to SQL supported stored procedures.  I said sure and showed him some examples of how I was using sprocs to get data.  And then he asked if it supported stored procedures that returned multiple result sets.  I told him I didn't know, but thought it had to.

    When I first started working with it, I noticed that every stored procedure returned an object of ISingleResult<T>.  And I wasn't using any sprocs that returned multiple sets.  I also noticed that there was an IMultipleResults interface.  So today I thought I would see what there was to see on it.

    I started by creating a simple test sproc:

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE multipleResultSets
    AS
    BEGIN
    	SET NOCOUNT ON;
    
    	DECLARE @ResultOne TABLE
    	(
    		  FieldOne int
    		, FieldTwo varchar(50)
    	)
    
    	DECLARE @ResultTwo TABLE
    	(
    		  Id int
    		, Color varchar(50)
    	)
    
    	INSERT INTO @ResultOne 
    	SELECT 1,'Hello'
    	UNION
    	SELECT 2,'Blue'
    	UNION
    	SELECT 3,'World'
    
    	INSERT INTO @ResultTwo
    	SELECT 1,'Green'
    	UNION
    	SELECT 2,'Red'
    	UNION
    	SELECT 3,'Blue'
    
    	SELECT * FROM @ResultOne
    
    	SELECT * FROM @ResultTwo
    	
    END
    GO
    
    

    With that in place, I moved on to creating a .dbml file in a Visual Studio solution and dragging in the sproc.  No matter what I did, it would always create a method in the designer using the ISingleResult interface.  As an aside, if there is anyone out there that knows how to change that via the designer, please let me know.

    Undaunted, I did some research in MSDN and the great book, LINQ in Action, studying the IMultipleResult interface and how to get it to work for me.  The gist is that you write a partial class to extend your datacontext, write a method that returns IMultipleResults and decorate it with the ResultType attributes of the types the method supports.  So that gets you this:

    public partial class TestDBDataContext
        {
            [Function(Name = "dbo.multipleResultSets")]
            [ResultType(typeof(FirstResult))]
            [ResultType(typeof(SecondResult))]
            public IMultipleResults GetMultipleResultSets()
            {
                IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())));
                return (IMultipleResults)result.ReturnValue;
            }
        }
    

    The only other thing I needed was the types that I just referred to in the above method

        public partial class SecondResult
        {
            private int mId;
            public int Id 
            {
                get
                {
                    return mId;
                }
                set
                {
                    if (mId != value)
                    {
                        mId = value;
                    }
                }
            }
    
            private string mColor;
            public string Color 
            {
                get
                {
                    return mColor;
                }
                set
                {
                    if (mColor != value)
                    {
                        mColor = value;
                    }
                }
            }
        }
    
        public partial class FirstResult
        {
            private int mFieldOne;
            public int FieldOne
            {
                get
                {
                    return mFieldOne;
                }
                set
                {
                    if (mFieldOne != value)
                    {
                        mFieldOne = value;
                    }
                }
            }
    
            private string mFieldTwo;
            public string FieldTwo
            {
                get
                {
                    return mFieldTwo;
                }
                set
                {
                    if (mFieldTwo != value)
                    {
                        mFieldTwo = value;
                    }
                }
            }
        }
    

    And finally, a test for it all

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Linq;
    
    namespace LINQTest
    {
        class Program
        {
            static void Main(string[] args)
            {
                TestDBDataContext context = new TestDBDataContext(@"Data Source=LEVIATHAN\SQLEXPRESS;Initial Catalog=TestDB;Integrated Security=True");
                System.Data.Linq.IMultipleResults results = context.GetMultipleResultSets();
    
                List<FirstResult> ones = results.GetResult<FirstResult>().ToList<FirstResult>();
                List<SecondResult> twos = results.GetResult<SecondResult>().ToList<SecondResult>();
    
                Console.WriteLine("\n\nIn One:");
                ones.ForEach(delegate(FirstResult one){Console.WriteLine(one.FieldTwo);});
    
                Console.WriteLine("\n\nIn Two:");
                twos.ForEach(delegate(SecondResult two){Console.WriteLine(two.Color);});
                
                var both = (from o in ones
                            join t in twos on o.FieldTwo equals t.Color
                            select o).ToList<FirstResult>();
    
                Console.WriteLine("\n\nIn both:");
                both.ForEach(delegate(FirstResult o){Console.WriteLine(o.FieldTwo);});
    
                Console.ReadLine();
            }
        }
    }
    

    Viola!

  • JaxDUG Needs a New President

    I have decided that it is time for me to step down as President of the Jacksonville Developers User Group.  My time as president has been educational for me, and I appreciate the new friends I have made, some of which I might not have met any other way except by being in that office.  I still plan to be available to the community, but I seek to apply more focus, time, and effort to other aspects of my life. 

    This is the official notice and call for those interested in taking up the position of JaxDUG to email me at jonathan.bates@batener.org.  As candidates submit themselves, I'll add it to the blog announcement for the November 5th meeting.  If there is more than one candidate, we will have the election at the end of the next meeting on November 5th.  Each candidate will be given some time to speak and those in attendance will be able to to vote.

    Update: A Candidate List Emerges!

    The following have expressed an interest in leading the group:

    • Bayer White
    • Adam Lowe

  • jQuery will ship with Visual Studio

    This is great news for ASP.NET web developers.  jQuery is a great JavaScript framework, and now with it shipping with Visual Studio, it makes the sell easier to businesses.  No more going to a third party site.  It should be easier to make the case since it is a part of the development toolset, with all of the great Intellisense and other features one gets used to (depends upon) with Visual Studio. 

  • WCF/WF and Namespaces

    Ran into an issue today:

    Service 'N1.SN1.SN2.YourService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

    Inherently, I thought that there should be no difference between this:

    namespace N1.SN1.SN2
    {
      class YourService {}
    }
    

    and this:

    namespace N1
    {
      namespace SN1
      {
        namespace SN2
        {
          class YourService {}
        }
      }
    }
    

    I seem to not be exactly correct on that score.  While either will compile with no error, using the first option I get the error posted at the top.  I use the second, and all is hunky-dory with the world.  Go figure.  Hopefully this will help some others that run into a similar issue.

  • A Club Just for Me

    I have been trying to wrap my head around this whole social networking thing.  I can't say that I am doing all that well, as it seems to be a large concept and I seem to have a tiny mind.  But one of the routes to better understanding was sticking my toe in the waters of this thing, and my particular water choice was Facebook.

    As I attempt to grok this, I thought one of the things I would do is only be friends with my friends, or at a bare minimum, people I know.  That is until today.

    Today I got a notification saying that Jonathan Bates wanted to be friends with me.  The first thought that floated up in my under-caffeinated mind was that my account had somehow been compromised, either my email or my Facebook.  My next thought being that maybe my uncle had joined and found me.

    After logging in and confirming all seemed to be well, I looked at the invite.  Some kid in the UK (named, oddly enough for this story, Jonathan Bates) has formed The Jonathan Bates Appreciation Collective, with a motto of

    "Strictly for members called Jonathan Bates!!!Go on, run with it, it'll be grand."

    The pure arbitrariness of my father choosing to name me after his youngest brother has finally paid off.

  • Comic strip extra funny via unexpected serendipity

    I enjoy comics.  Most that know me know that I enjoy comic books, but I also enjoy newspaper comic strips.  In fact, when I go to a new city, one of the things on my list to try is the local paper and the comic strips.  Judge me how you may.

    In this digital age, I don't need to be bound by my geography in order to appreciate comics that aren't featured in the quite limited listing of Jacksonville, FL.  I could reach out on the interwebs (its just a series of tubes) and get most comics without spending a dime or leaving my chair.  I haven't embraced this paradigm, as I still like the feel of ink and paper, but a friend of mine has.  He sent me two strips that posted the same day, Hi & Lois and Pearls Before Swine

    So first: Pearls Before Swine

    Pearls Before Swine, 9/8/2008

    And now, Hi & Lois for the very same day:

    King Media wasn't as accommodating as United Media for the image. Click this link to see the 9/8/2008 comic as hosted from the Seattle Post-Intelligencer.
More Posts Next page »

This Blog

Post Calendar

<December 2008>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Syndication

Powered by Community Server, by Telligent Systems