Dan Rigsby – Coding Up Style

Developer.Speaker.Blogger

Archive for June, 2008

Lansing Day of .Net

Posted by Dan Rigsby on 28th June 2008

DSC02881This weekend I spoke at the first Lansing Day of Dot Net in Lansing, MI. This trip was a bit different as my wife joined me for the first time.  She didn’t come for the Day of .Net, but afterwards we headed up to Mackinac Island for an anniversary trip.  She did enjoy the event though and even got to attend my session.

We got up to Lansing on Friday night after dropping out daughter off at the in-laws in Fort Wayne, Indiana.  We arrived around 6:30 pm and met up with Joe Kunk, Keith Elder, Jeff McWherter, Jeff’s wife, Vivek Joshi, Vijay Jagdale, and others at the local Kinko’s.  Somehow my wife and I got tricked into helping fold pocket-mod event schedules while we were there.  Afterwards, we went to a local Lansing event called the Festival of the Moon which as to commemorate summer nights.  It was basically just a fenced in beer garden.  We met up with Alan Stevens, his wife, and James Bender there.  We didn’t stay too long as we got a bit bored with the drunken crowd and odd choices of music by the local band.  We ended up heading across the street to a local pizza shop that offered Karaoke.  Jeff, Alan, Keith, and myself all stepped up to the mic and performed our own renditions of various tunes.  It ended being an early night since many of us had to speak in the morning. While in Lansing, my wife and I stayed with Vijay who graciously let us use a spare bedroom he had instead of paying for two nights in a hotel.  Thanks for your hospitality Vijay!

On Saturday morning we headed to the event.  I quickly met up with a number of old friends: Dave Redding, Chris Woodruff, Michael Wood, Carey Payette, Michael Eaton, Jason Follas, Patrick Foley, Josh Holmes, Jennifer Marsman, and Jay Wren.  I also got to meet Len Smith and Sam Nasr and help forge some new friendships.

Sessions

Distilling the Dynamic Language Runtime

Josh Holmes kicked off one of the first sessions with a talk on the DLR and the relevance of dynamic languages in today’s world.  Josh is a Microsoft Evangelist and an amazing speaker.  I was very surprised to see that there were only 10 attendees in his session.  I can only attribute this to the fact that he held one of the first sessions of the morning.  Originally the event was suppose to start at 9am, but a few days before, they moved the start time to 8:30.  I surmise that many people hadn’t made it to the event yet.

Josh did a great job as usual.  This session was very introductory, but it was still informative and put things into a perspective that I hadn’t quite thought of before.  Here are my notes on his session:

Languages ProgressionDSC02882

Early Languages

More at machine level and programming against registers at a low level

Modern Languages

C++, VB

Frameworks

Java and .Net allow us to write against a framework that talks to a machine.

Looking back over the history of languages, Smalltalk and LISP are dynamic languages.  LISP is 50 years old.  Why didn’t dynamic languages take off?  Some say dynamic languages were infer.  However as we get more powerful PCs a dynamic language becomes more viable

What is a Dynamic Language

  • Analogy of taking everything with camping, like running shoes, and even canoe.  Then as the trip changes, you can adjust.  If you feel like hiking, then you have your shoes.  Everything you could need is with you.
  • Decisions limit options.  Make a decision to go down a long road means there aren’t options to move.
  • Agility = Options, Quarterbacks have options of different receiver they can use
  • Dynamic languages emphasis runtime over compile time
Dynamic typing (or duck typing)

Type can change at runtime. “If it looks like a duck and talks like a duck, then its a duck”.  Josh gave an example where at a banking company they used a 16 bit integer to store values, but as time went on, that was not enough.  It would have been nice to use a dynamic language and allow the variable to expand and adjust as needed.

Dynamic Features

Open up the types at runtime which allow you to inject new properties to existing and running classes. Add the ability to dynamically add new properties to objects.

“Trade CPU cycles for productivity” Dynamic languages are slower, but its all about the trade of ideas.

About making your life easier, not the CPUs life easier.  CPUs are getting faster, why not harness the ease for the developer and user.

Evidently, Ruby is now Josh’s favorite language.  In Ruby, one of the goals is to reduce line noise (things such as variable declarations, casting, semicolons, etc is just noise).  Strings in Ruby are mutable.

What is TDD?

Test Driven Development

Analogy of Car assembly: A car isn’t sculpted as one piece.  A car is built out of many different components. Each part of a car is designed and independently tested before it is put in place.  (However, they aren’t always tested well together).  This is a lot like unit testing.  Each unit of code should be defined and tested.

Yagni (You aint goina need it) – Don’t waste time building stuff you aren’t going to need.  If you design your tests before you write your code, then you are building specifications for how the code should work.  Anything that doesn’t have a test must be fluff.

Steps in TDD
  1. Write tests based off of requirements
  2. Run the tests to make sure they fails.  If a test doesn’t fail, how can it be a good test?
  3. Write just enough code to pass the test.
  4. Go back and write more tests (step 1), and continue down the list

The tests become the documentation for how to write the code.

Dynamic Language Initiative in .Net

CLR –> Frameworks –> DLR –> Langauges

Python was originally written in C.  Eventually there was a Java implementation of python called jython.  When IronPython came along it ended up running twice as fast as standard editions of python.

Regular Expressions can be your Friend

Vijay ran a session on Regular Expressions and since he was hosting us for the weekend, I really wanted to make sure I attended his session.  He did a great job of introducing regular expressions and what is possible with them.  He event got into ways to help circumvent text based attacks.  The only real suggestion I have on the presentation is to go over some of the differences in how regular expressions are implemented in different languages.

I was surprised at the number of people who attended and how much the audience got into the topic.  This presentation contained a lot of code and demos which really fit well with the flow of the topic.  I hope to see Vijay continue to speak at future events.

Manage Complexity with Agility

Alan Stevens gave this session which covered an Introduction to Agile and the MVC pattern.  I have never gotten to attend one of Alan’s speeches before due to other conflicts, so I was glad to be able to attend this one.  Alan did a great job.  His explanation and examples of the basics of MVC and TDD were amazing.  There is no way I could have given that good of an introduction.  I went into session knowing this material, but it was great to see things in a new light, and you could see people in the audience get that little “ah ha” look.  I look forward to catching some of his talks in the future.

My Session: Agile Project Management with Scrum

DSC02887My session had a modest 30 or so attendees.  I covered project management, what is “Agile”, and gave an overview of Scrum.  The audience had a number of good questions and comments.  This was the first speech of mine that my wife attended, she commented, “You did better than I expected, not that I expected you to be bad”.  I am not sure how to take that, but I think it was meant as a complement.  I do think that I get better each time I speak, but I have a long way to go to get as good as many speakers that I see.  I had a number of people come up to me after the session to make comments and ask more about how they could apply Agile techniques at their own companies.  Many people still seem to think that these techniques cant be applied to their environment.  I hope that I can help change that perception over time.  I have some ideas for some other Agile talks, hopefully they will see the light of day and be picked up at future events.

The materials from my session can be found here: http://www.danrigsby.com/files/Presentations/AgileMgmtWithScrum.zip

Closing Thoughts

The Lansing guys did a fabulous job for their first day of .Net.  I was amazed at all of the details they put into the event such as shirts for all attendees, commemorative cups for every speaker, a local camera crew to document the event, getting the mayor of Lansing to give closing remarks, etc.  I will do my best to get on the speaker list again next year.  I am sorry for those who didn’t make the trip up, this event was well worth the time and price of gas.

After the event, Jeff McWherter hosted an afterparty at his house which he claimed took more planning than the actual event itself.  Jeff really organized a high quality afterparty.  Most of the speakers and a lot of the event attendees made it out.  There was a lot of food, even more alcohol, and most importantly many good conversations about .Net. Unfortunately, my wife and I left around 9pm.  We still had to start our anniversary trip up to Mackinac Island in the morning.

Posted in Community | 5 Comments »

IndyPASS 3rd Birthday Bash

Posted by Dan Rigsby on 18th June 2008

DSC02863 IndyPass is the Indianapolis Professional Association for SQL Server.  Tonight they celebrated their 3rd Birthday Bash. The speaker was Tom Pizzato, Data Platform Architect, at Microsoft.

John Magnabosco kicked us off with the introduction.  He gave the usual announcement events, board elections, etc . John ended by asking for job announcements, but was interrupted by the famous Buck Foley.  Buck is a “Matt Foley” impersonator (the ‘van down by the river’ character played by Chris Farley on Saturday Night Live), and the actor is a ‘Database Guy’ by profession.  He brings his own flavor of humor and applies it to SQL technologies. Buck seemed to be under the impression that he was the main speaker and not Tom Pizzato who he called “Pizza-Toe”.  He winged his talk this time, but it was still humorous and set a light hearted tone for the rest of the meeting.

Tom’s talk was broken into two sections: a detailed talk about new features followed by a series of demos.  The talk mainly went over all of the new features and changes in SQL Server 2008.

Tom’s Talk

DSC02865 Amazing Journey

Tom has worked with SQL Server for close to 19 years.  He started his talk by taking us a down memory lane by showing some of the original disks for the first version of SQL Server back when it was just a OS2 port of Sybase.  He also  picked fun of the fact that there was a launch event for a product that has not yet been released. A few items of interest from his introduction were:

  • Microsoft is still on track for a Q3 launch of SQL Server 2008, but skill couldn’t give us a more specific date yet.  The next version of SQL Server will be in 2010 (at least that is where it is planned).
  • FileStream data cannot be saved to a separate machine in SQL Server 2008.  it is still limited to the machine running SQL Server 2008.  Microsoft knows this is a limitation, but they chose to just get the feature out there first.

Protect your Information

  • Secure Access
    • Strong Authentication
    • Granular Authorization
    • Transparent Data Encryption (TDE)
    • External Key Management
  • Protect System
    • Secure Deployment
    • Secure by default: This ones  is going to be a pain for some people.  Secure by default means everything is turned off by default.  Microsoft is taking this mind set into all of its major projects.  I have talked about this before in terms of Wcf, but we also see it in Windows Server 2008 where almost no features are installed by default.

Ensure Business Continuity

  • Ensure Availability
    • Mirror your data: Automatic repair of primary from backups
    • Failover clustering
    • Replicate your data
  • Minimize Downtime
    • Online Operations: More to help you keep your system up including, hot swapping CPUs while running in production
    • Add system resources
    • Reduce Recovery time
  • Concurrent Access
    • Database Snapshots: Not many changes here
    • Snapshot Isolations

Predictable Response

  • Optimize Performance
    • Efficient Data Storage: Finally Compression at the data and backup levels. in SP2 for SQL Server 2005, the vardecimal datatype was introduced which helped open the doors for this feature.
    • Prescriptive Guidance
  • Analyze Performance
    • Data Collection: Collect reports instead of wiping them
  • Predict Performance
    • Plan Freezing: Allow you to save query execution plans to xml that can be run on other machines.
    • Resource Governor: Set up resources into pools and assigned users to them.  Such as giving 70% CPU and memory to a power users and  rest to non-power users.

Reduce Management Cost

  • Flexible Administration
    • Visual Management: Management Studio improvements, Powershell integration, etc.
    • Automate Operations
  • Manage centrally
    • Enterprise Policies
    • Monitor Compliance
  • Monitor Health
    • Management Reports
    • Performance Tuning Tools

Simplify Development

  • Easy Access
    • Model Entities: Models can be built off multiple tables such as a “User” entity that spans multiple tables.  LINQ can then be used to query over this data. This is what is formally called LINQ to Entities.
    • Integrated Query: Most of the LINQ stuff is slightly slower, but it is a trade off of getting the code done faster development vs. performance.  This is also know as LINQ to SQL.
    • Comprehensive connectivity
  • Program data logic
    • Time aware applications: Introduced separate Date and Time fields.
    • Pass data results
  • Sync your data
    • Local data storage
    • Offline Synchronization

Store your information

  • Unstructured Information
    • File Storage
    • Search Text
    • Extensible Types
  • Geospatial Information
    • Spatial Standards
    • Visualize Location
  • Structured information
    • Model complex hierarchies: No more need to use CTEs to recursively query data to build hierarchy trees.  The new Hierarchy data type can store these values
    • Enhanced Partitioning

Integrate and Manage data

  • Build Faster
    • Connect to data
    • Cleanse Data
    • Integrate data
  • Manage Efficiently
    • Efficient Data Storage
    • Mange mixed workloads
    • Streamline Aggregates
  • Scalable Performance
    • DW Query Optimizations: Lots of optimizations in performance of Star joins
    • Enhanced Partitioning: Easier to align partitions with their indices.

Deliver Relevant Reports

  • Author reports
    • Enhanced Designers: Licensed technology from Dundas to create better and more professional looking reports.
    • Flexible Layout: Introduced Tablixs.
  • Manage reports
    • Enterprise Platform: SSRS was rewritten to not require IIS and scale better in the enterprise
    • Server-based Deployment
  • Deliver reports
    • Rich Visualizations
    • Render in office
    • Share reports

Drive Actionable Insight (Analysis Services)

  • Build Analytical Solutions
    • Scalable Platform
    • Prescriptive Guidance
  • Extend Reach
    • Manage KPIs: How many Microsoft tools report KPIs?
    • Predictive Analysis
  • Deliver Insight
    • Work in Office: Data mining add-ins for office allow you to mine and report on data directly from Office tools
    • Business view of data

Tom’s Demos

Demos were done using SQL Server 2008 CTP 6.  Tom had 9 demos to show but only got to 6 of them.  The demos were run from a custom application that had the queries and results all displayed in a custom window.  This was obviously a pre-canned set of demos or at least a pre-canned tool, but it was a great way to display these features.  I know it took a lot of time to put together,

Auditing

  • Auditing performance can eat up to 10%
  • Audit logs are stored in a separate file on the disk.  These files are not xml or directly human readable, but at least they can’t be queried like any other table.
  • Audit logs can be maintained by setting up rollover files and file sizes

Compression

  • Compression types can be set at the row or page levels

Powershell

  • Only works for the relational engine
  • Can right click on teh database in management studio and say “Open Powershell”
  • Once in powershell you can say “dir”and get the list of database objects including being able to drill into tables, users, etc. 
  • You could even run more complex Powershell queries such as the ability to get tables where row count is > 1000 like:
    • dir | where < $._RowCount -gt 1000
  • You can pipe results out to HTML or other mediums

Freezing Plans

  • Gives you the ability to take a query execution plan and save it to XML
  • Can then specify when plan to use when executing a query

New DateTime Datatypes

  • Separate Date and Time datatypes
  • A new DateTimeOffset datatype supports years 0001 to 9999 as well as storing time zone information
  • A new DateTime2 datatype supports years 0001 to 9999

Table Value Parameters and Merge

  • This was the last feature dropped from SQL Server 2005
  • A new MERGE statement allows merging of rows from multiple tables. You can choose to update matched rows, insert unmatched rows, or delete unmatched rows from the primary table.

Prizes

I know a lot of people probably only came here for the prizes, and there were some great giveaways again this year.  There was an Xbox, a 30 gig Zune, two 8 gig Zunes, and a slew of books and other swag.  As usual I didn’t win anything, even though the odds were pretty good.  But I came here for the event more than the prizes

Final Thoughts

I do miss having Bill Baker at the Birthday Bashes, but Tom has been filling in nicely. He is a good speaker, is able to answer most questions, and is very competent in his skills. He was asked some detailed questions about LINQ to SQL and LINQ to Entities that he couldn’t answer, but he wasn’t afraid to punt on them and commit to getting Joe Healy to come to talk about LINQ at a future meeting.  I am looking forward to future events at IndyPASS.

Posted in Community, MSSQL | 1 Comment »

REST and Max URL Size

Posted by Dan Rigsby on 17th June 2008

I have heard many people say that the definition of REST is to just put everything in the URL.  This isn’t true.  One of the tenants of REST is to “embrace” the URL and use it as much as possible, but moving information to POST data is just as important and often necessary.  I can understand how this can be misunderstood.  Most REST interfaces do take in all values in into the URL to make it easier to navigate the data.  Having to build a POST package can be tedious at times.  So, what if you do want to send larger data to the service?  When should you decide to move away from a pure URL approach and start using POST data in the header?

Browser and WebServer Limits: http://www.boutell.com/newfaq/misc/urllength.html

  • Internet Explorer: 2,083 characters, with no more than 2,048 characters in the path portion of the URL
  • Firefox: 65,536 characters show up, but longer URLs do still work even up past 100,000
  • Safari: > 80,000 characters
  • Opera: > 190,000 characters
  • IIS: 16,384 characters, but is configurable
  • Apache: 4,000 characters

Different things can happen when you go beyond these URL limits depending on the browser and web servers. It could be a “413 (Entity Too Large)” error, “414 (Request-URI Too Long)” error, the URL could be truncated, or it may just work.  However since different things can happen and your service could be consumed by any source, you have to assume the worst could happen.

By looking at just these numbers, it seems you would be pretty safe with a URL that gets up to 2,000 characters.  However, lets look at the W3C standards on this.  The HTTP specification doesn’t really set a size for the length of a URL, but it does recommend being cautious when going above 255. According to Hypertext Transfer Protocol – HTTP/1.1 section 3.2:

Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.

So for the sake of a REST interface you should avoid setting up an interface where there is any possibility of a URL getting beyond 255.  If you are using a GET verb to request a resource via the URL you should be pretty safe.  However POSTing or PUTing an insert or update via a URL may not be the way to go unless the data size is very small.

The most important thing is to keep your interfaces consistent.  You don’t want one operation that allows an insert via the URL and another through POST data.  This just makes things confusing and less discoverable.  Especially since REST has no way to publish metadata about the operations.   You could follow standards such as these:

CRUD Operation HTTP Verb Data Location
Create POST or PUT POST Data
Read GET URL
Update POST or PUT POST Data
Delete DELETE URL

In general this follows “High REST” which is the more pure REST.  This dictates that the HTTP Verbs define the methods to act on the resource.

Ultimately it’s up to you how you implement the REST interface, but stay consistent, be careful about URL limits, and try to follow industry standards.

Posted in REST, Wcf | 2 Comments »

ThirstyDeveloper Podcast: The Blogging Episode

Posted by Dan Rigsby on 12th June 2008

ThirstyDeveloper_small

A few weeks ago Larry Clarkin came down and interviewed my friend Jeff Moser and myself for an episode of the  ThirstyDeveloper podcast on Technical Blogging.  Larry wanted to do an episode about what it takes to create a professional technical blog and why every developer should consider it.   Jeff and I have different types of blogs, and it was good to get multiple perspectives on things.

It took a few weeks, but the post editing work is done and it is available to listen to.  Overall, I think the interview went pretty well, but listen to it yourself and post your own comments about what you like, what we could do better, or anything you else you want to add.

The link to the episode is: http://thirstydeveloper.com/2008/06/11/TheThirstyDeveloper24TheBloggingEpisode.aspx

Posted in Podcast | No Comments »

Software Development Meme

Posted by Dan Rigsby on 12th June 2008

Meme I got hit by the latest developer oriented meme trekking through the blogosphere.  My friend Michael Eaton started this one, but it has taken a life of its own.  I figured eventually someone would tag me specifically to fill this out.

Here is the trace of how this request eventually got to me:

Michael Eaton (post) -> Sarah Dutkiewicz (post) -> Jeff Blankenburg (post) -> Josh Holmes (post) –>  Larry Clarkin (post) –> me (answers below)

1. How old were you when you started programming?
I was 11.  I remember it distinctly as it was when I got my first computer, a Commodore 64.  The entire OS was BASIC driven. I loved to copy programs out of the back of Basic Magazine and “try” to get them to work.  I eventually got into RPL and some C++ in high school.

For most of my youth and through college, I considered computers and programming as a hobby.  I started college working on Pre-Med degree, but ended up settling for a Psychology degree like Jeff Blankenburg.  After school I tried to use that degree, but could barely make ends meet.  I ended up going back to school a year later to attempt to get a CS degree.  I made it all the way up to senior project, but decided to just take my knowledge and get job.  This was back in 1999 and the Internet bubble was in full swing.

2. How did you get started in programming?
I think the answer to the previous question and this blog post sum things up.

3. What was your first language?
Commodore BASIC

4. What was the first real program you wrote?
In high school I wrote a few programs.  One that I remember was for my HP 48SX calculator (loved that calculator, but it was stolen in college).  I had done most Basic up until then, but when I got this calculator I really got into RPL (Reverse Polish Lisp).  It was a fun language and quite a jump from Basic. It was a simple rock/paper/scissors game.  There were no laptops back then and paying attention in class was boring.  Instead I found it more exciting to write programs on the calculator.  Naturally I ending up writing a lot of applications for that calculator in high school.

5. What languages have you used since you started programming?
Basic, RPL (Reverse Polish Lisp), C++, Cobol, Java, Javascript, Visual Basic, C#

6. What was your first professional programming gig?
I looked for my first job for about 2 months.  With no CS degree or programming experience, it was hard to get my foot in the door.  I eventually found a job at a small aviation repair company.  I think they were looking for the cheapest developer they could find, but I was happy to get a chance to work on something and get some experience (and a paycheck).  This ob was originally just suppose to be a 6 month stint, but they tried to keep me on longer. I might have stuck around, but I was eager to work with other developers.  At this aviation shop I was the sole IT department running CAT 5 cable, building/maintaining PCs, creating a Database, setting up email, developing a client application in VB6 as a front end to the database, building a classic ASP web site, etc.  I went to Interactive Intelligence after this job and have been there ever since (8.5 years and counting).

7. If you knew then what you know now, would you have started programming?
I was born to code, and I try to live life with no regrets.  Everything that I have done in my life and the events that occurred have made me who I am today.  If I changed one event in my past, I may not be where I am today or may not have met my wife.

However, I do love to program.  Knowing what I know now, I wouldn’t have stopped developing and would have jumped right into Computer Science in college.

8. If there is one thing you learned along the way that you would tell new developers, what would it be?

  1. Get involved in the community.  User groups may be over your head, but that’s good to learn from.  Or user groups may be too basic for you, but that’s good to learn from too.  Community involvement is a great way to network and help others.  It also helps you share ideas and propose issues to your network of peers.
  2. Start a blog.  Even if you think you are a bad writer, you will get better.  I am a terrible writer, but it is something I am working on.  Blogs help you share knowledge, store knowledge for yourself, provide samples of your code for future employers, etc.  There are many reasons to start a blog, but every professional developer should really consider getting something out there.
  3. Use a tool like Google Reader and subscribe to blogs.  One of my interview questions is: “how do you say up to date with new technologies and industry trends?”  Reading blogs is a great way to stay up to date, but manually checking dozens of web sites everyday is tedious.  RSS makes things much easier because it only pulls updates.  You can check your RSS feed many times a day, but it will check all of your blogs for updates and report it to you in one interface.  Personally I am up to around 150 blogs that I follow.  It does help to have a folder hierarchy to help organize your blog feeds though.  You can start by subscribing to this blog.

9. What’s the most fun you’ve ever had … programming?
I have a lot “most fun” days.  For the most part every day is a new “most fun” day.  In particular I like days when I can code with others.  Sitting in the back room or Ivory Tower solo programming is great, but it’s a lot of fun to program with others.

10. Who are you calling out?
I am going to hit up a few of my Indianapolis tweeps who blog:

 

read-silently

Posted in Personal | 1 Comment »

New Webcast: Creating Snippets in Visual Studio

Posted by Dan Rigsby on 9th June 2008

I have a new 4 min 47 sec training webcast out over creating code snippets in Visual Studio 2005 and 2008.  The video is available through JupiterMedia and can be viewed at http://www.internet.com/video/. Just look for the "Developer Video" titled "Creating Snippets in Visual Studio".  Direct link is:

http://www.internet.com/video/?bcpid=1431564240&bclid=1433966034&bctid=1589625246

Posted in Visual Studio, Webcast | 2 Comments »