Scott Hanselman

Twitter: Let the Information Wash Over You

June 29, '09 Comments [24] Posted in Musings
Sponsored By

twitter-duck-01aThere's a lot of information, both useless and useful, on Twitter. When you get started on Twitter the shear amount of crap can be totally overwhelming.

Twitter's a lot like Tivo (Digital Video Recorders). It'll record everything and everyone you're interested in, and while this seems like a great idea, just like your Video Recorder, what was once a joy quickly becomes a chore. I've got dozens of shows on my recorder...I thought TV was supposed to be fun, now it's become a To-Do List. The same thing happens with Twitter. If you expect Twitter to be high signal and low noise, it's not the medium for you.

If you make Twitter into another list of crap to read, you will be sad. The sooner you realize that Twitter is just a list of crap, the happier you'll be.

Just let it flow over you like water on a duck's back. When you follow someone on Twitter, you're following the whole person. You might find out where @levarburton went to lunch that day. You might see pictures of me taking my kids to see Thomas the Tank Engine. You may see @BillyMays (RIP) last tweet as he gets off a plane. You can get news and opinions, pictures of planes in the Hudson, and find out where famous folks use the toilet. Truly thrilling.

Twitter is a lifestream and just as you'll miss stuff in life, you need to accept you'll miss stuff on Twitter.

Sometimes people will "unfollow" you (or me) and they'll tweet why. I have had a lot of people unfollow me because there's "not enough .NET content" in my tweets.

However, as @unclebobmartin says:

Twitter is not a single topic medium. If you follow someone you follow the whole person.

This statement might seem obvious, but it's not obvious to everyone. Uncle Bob and I don't agree on politics. That doesn't mean I'm going to unfollow him. I'm also not following him because I think I'll miss some deep insight on Software Architecture. I follow Uncle Bob because I like Uncle Bob. He is a full and complete person and he's interesting. When he stops being interesting, well...let's just hope for his sake, he stays interesting. ;)

I use a few tricks with Twitter to stay on to of things without them becoming stressful. That's the key. If Twitter stops being fun, consider Quitting Twitter rather than following everyone.

Twitter Rule #1 - Follow Liberally

Twitter without People isn't Fun. I'll use me as an example, because I'm on Twitter, but note that I'm not the point, just an example.

Sometimes someone will tweet that I've (personally) "filled their twitter timeline." Then I'll take a look at their Twitter account and notice that they are following maybe 7 people. Usually something like 6 friends, the me. This would be like going to a cocktail party with, well, 6 of your friends, and me. That would be obnoxious, or rather, _I_ would be obnoxious. No one would want to go to that party, it would be lame.

To have a real cocktail party, you need a lot more people. Forgive me as I quote myself (ya, I know):

It's a river of uselessfulness and truthiness. It's a permanent cocktail party where you know some folks, and don't know others. Some are famous, some are your friends. There's a the constant background of overheard conversations, except on Twitter, it's socially acceptable, nay, encouraged, to jump in. No need to say, "oh, I couldn't help but overhear, excuse me but..."

To really get something out of Twitter you need to follow at LEAST a hundred people of various backgrounds. Really mix it up. If you're really into just .NET and only want to see .NET tweets, I'll talk about how you can filter in a second.

Still, take a moment and drink this in. Follow liberally. You're following people, not topic experts. They'll tweet jokes and stupid stuff as often as they'll tweet code and useful tips. You'll need to follow a large swatch of people in order to get a wide and diverse experience on Twitter.

Some folks say that they can't find anyone interesting to follow. This is nonsense. Here's a tip. Find ONE interesting person, and see who THEY follow. Rinse, repeat. I've found 1000 interesting people this year. Turns out the world is full of them, and 0.1% of them are on Twitter.

Twitter Rule #2 - Use Search Effectively

Search is integrated into Twitter's website now, when it wasn't before, so that's useful, but I'm still surprised how few people notice that little search box. Make sure when you select a Twitter client that you select on that supports Search Columns. This is how you find info on topics when you're not necessarily interested in particular people.

For example, if you don't want to follow me, but you want to listen to conversations on ASP.NET MVC, make a search column with "ASP.NET MVC" in it.

I recommend these Twitter clients that effectively support search:

  • TweetDeck - The original "deck" full screen client. The first thing you need to do after you install is go to the settings and turn off the "All Friends" notification as it'll drive you insane. The second thing is to setup some columns for topics you're interested in.
  • bDule - A very nice client for Windows with a lot of of flexibility in how you can layout the columns. It also supports Facebook comments and likes.
  • DestroyTwitter - The new kid on the block, it's very minimalist in style but supports many themes. It can be small and thin or be like TweetDeck and have columns.

TweetDeck (2)I have columns in TweetDeck for Friends, Replies, Direct Messages, a search for "hanselman OR hansleman", a search for "Win7", a search for "asp.net", a search for "mvc," and a search for "diabetes." I also add searches for topics that I may find interesting that day or week, but then I'll delete them later. I had a Michael Jackson search for a few days, as an example.

Point is, make sure your Twitter Client supports search. Otherwise it's useless.

Twitter Rule/Tip #2a - Groups

Another way you can segment things is to use Groups. TweetDeck lets you put, for example, all your .NET people in one group and all your diabetics in another. This forces you to break up your party and assign labels to folks, but it's your party. That's another good thing to remember.

Twitter Rule #3 - Favorites as "Read Later"

When things are moving fast you often need a "read stuff later" button. While there is a service called Instapaper that is starting to get integration inside of some Twitter clients, it hardly has the broad support of a TwitPic or other 3rd party tool.

To solve this, I use "favorites" as my "read later." That means if I'm on my phone or my desktop and someone tweets something interesting or a link I don't have time to follow, I favorite it, then I came back later to read it. This simple technique has made things a little calmer for me when there's tweets coming in faster than I can read them. I just hit the little "star" icon in my twitter client that every client supports and I'll get to it later.

Conclusion

So, if you want to follow the Whole Person, follow me on Twitter. If not, just hang out on the blog, there's no hard feelings. :)

Also, consider reading my post on How To Twitter - First Steps and a Twitter Glossary

*Twitter Duck Image courtesy of Paul Söderholm

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Weekly Source Code 43 - ASP.NET MVC and T4 and NerdDinner

June 25, '09 Comments [9] Posted in ASP.NET | ASP.NET MVC | NerdDinner | Source Code
Sponsored By

UPDATE: David's put the T4 template with some nice updates on CodePlex - It's the last download here.

I really advocate folks reading as much source as they can because you become a better writer by reading as much as writing. That's the whole point of the Weekly Source Code - reading code to be a better developer.

Reading code in Open Source projects is a good way to learn, especially if the project has been around a while and been successful, or if you already respect the team of people working on it. Less reliably, you can find snippets of code by searching and sharing code.

David Ebbo is scary clever. You know someone is smart when they come up with something you don't think you yourself could come up with on your own, but you still kick yourself for not thinking of it in the first place.

David's been experimenting with ways to make ASP.NET MVC better, specifically in the area of strongly-typed helpers. He's trying to get rid of strings, magic or otherwise.

He started with a BuildProvider (not a lot of folks know about BuildProviders...it's a powerful secret.) David didn't like these kinds of links in ASP.NET MVC:

<%= Html.ActionLink("Home", "Index", "Home")%>

So his BuildProvider would get added to the web.config:

<buildProviders>
<add extension=".actions" type="MvcActionLinkHelper.MvcActionLinkBuildProvider" />
</buildProviders>

And it would give you better methods like this, by poking around in your project and dynamically generating helper methods for you:

<%= Html.ActionLinkToHomeIndex("Home")%>

image_7Then, just days later, David got the T4 religion (I've argued we are doing a poor job of promoting this, so I'm telling everyone I know) and you should too. David explored the pros and cons of CodeDom vs. T4 for CodeGen then recreated his ASP.NET MVC Helpers using T4.

He's enabling not only better ActionLinks, but also Action Url Helpers, Constants for View Names, and a very clever thing, helpers for View Models, courtesy of David Fowler.

I thought this was particular cool, because it's a really visceral example of what you can do with Code Generation when you start exploring what you know at compile time with what you wish you knew at Design Time. It also reminds us that it's more than just Compile/Test/Run - your projects become more "meta" when you've got Inspect/CodeGen/Compile/Test/Run.

For example, if you have a ViewModel that say, has a string, rather than:

<label for="Name">Name:</label>
<%= Html.TextBox("Name", Model.Name) %>
<%= Html.ValidationMessage("Name", "*") %>

Why not this instead:

<%= ViewModel.Name.Label() %>
<%= ViewModel.Name.TextBox() %>
<%= ViewModel.Name.Validation() %>

This ViewModel stuff is in the earlier CodeDom templates, but not (yet?) the T4 templates. I hope we see it again, don't you? What do you think, Dear Reader, of this approach vs. the "Opinionated Input Builder" approach?

Just recently David put out his "new and improved" MVC T4 template, which is the one you should check out. I'm gently pushing him to put it on CodePlex somewhere and bake this goodness in. (Go tell him and Phil!)

He was doing some stuff at runtime, but has since moved to a pure design-time approach.

David Ebbo's ASP.NET MVC T4 Template applied to Nerd Dinner

image_d417b977-3d4c-4d3c-88e6-438b7a32582c David took the NerdDinner app as his base, and installed his T4 template. Just drop it in, and magic gets generated. How does it work, though?

Before he was using reflection but since this is a Design Time Code Generation process he had to delve into the *gasp* COM-based VS File Code Model API. However, this does really show off the power and flexibility of T4 itself. Kudos to David for looking COM in the face and not blinking!

Go download his template (direct ZIP here) and open it up.

T4 files can be scary to view in a text editor as they are constantly switching between <% code blocks %> and the code that's being generated. I use Notepad2 to view them, using the (interestingly enough) XML Document option that gives me rudimentary syntax highlighting.

If you're serious about T4, go get the Visual T4 Community Edition from Clarius for half-way syntax highlighting, or pay for the Professional Edition. They'll register themselves with Visual Studio and give you a better experience than just all-black text.

The first line in David's T4 template that made me chuckle was the the first line that's executed:

<# PrepareDataToRender(this); #>

As they say, it's funny because it's true. This is typical of code generation templates of all kinds. It's the "DoIt()" method that takes the left-hand's code (the COM crap) and prepares it for the right-hand (the template itself).

In order for David to make his template tidy and enable this nice clean level of abstraction:

<#  foreach (var controller in Controllers.Where(c=>c.IsPartialClass)) { #>
namespace <#= controller.Namespace #> {
public partial class <#= controller.ClassName #> {
protected RedirectToRouteResult RedirectToAction(ControllerActionCallInfo callInfo) {
return RedirectToAction(callInfo.Action, callInfo.Controller, callInfo.RouteValues);
}
...snip...

...he has to prepare an object model, and that's what PrepareDataToRender does. It's funny also because it's buried at the end, as it should be. It's really a pleasure to read and does a LOT considering it's only a 415 line template.

He has a number of cute gems like this one-line helper function that combines a little COM a little LINQ and a little magic to a list of methods to his template using the Visual Studio API. I laughed at the "functionFunction" enum. "Do you like her? or do you like her like her?"

// Return all the CodeFunction2 in the CodeElements collection
public static IEnumerable<CodeFunction2> GetMethods(CodeClass2 codeClass) {
// Only look at regular method (e.g. ignore things like contructors)
return codeClass.Members.OfType<CodeFunction2>()
.Where(f => f.FunctionKind == vsCMFunction.vsCMFunctionFunction);
}

David is clearly deep into this exploration right now, and is asking your opinion about the design. I would encourage you to flood him with feedback, or leave it hear and I'll tell him. ;)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The HaaHa Show visits .NET Rocks

June 25, '09 Comments [14] Posted in Podcast
Sponsored By

3639851758_a6e4536564 While in Norway last week, Phil Haack and I were lucky enough to do a LIVE taping with Carl Franklin and Richard Campbell of .NET Rocks!

Hopefully the energy of the room is appropriately captured in the audio recording, because it was a hoot. The whole room was cracking up. It's always a joy to hang with Carl and Richard. Phil, less so. (Kidding!)

A small warning, though, this show may be entirely content-free, and while I can't exactly remember (We were all tired from presenting and likely hopped up on Pepsi Max) they may have been some coarse language.

You can listen to the show here. There's a number of formats available, including but not limited to, MP3 and WMA. If you want to subscribe, there's now a complete "master feed" of all .NET Rocks shows so you can get them all in one go if you like.

There's also a master feed of all Hanselminutes shows as well, by the way. Enjoy!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 166 - Windows Presentation Foundation explained by Ian Griffiths

June 24, '09 Comments [7] Posted in Podcast | Windows Client | WPF
Sponsored By

51DF0boY5fL My one-hundred-and-sixty-sixth podcast is up. Scott chats with Ian Griffiths about Windows Presentation Foundation (WPF). Why is it so hard to master? What techniques should the WinForms developer learn first? Scott's working on a side project, and he and Ian brainstorm ways for Scott's application to use WPF more effectively.

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is a sponsor for this show!

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

ASP.NET Ajax - Script Combining and moving ScriptResource.axd's to Static Scripts

June 24, '09 Comments [25] Posted in ASP.NET | ASP.NET Ajax | Javascript
Sponsored By

I've got a little something I'm doing and I wanted to take control over some scripts that were being added by ASP.NET WebForms. Remember that ASP.NET WebForms is designed around a control/component model, so you don't get 100% control over your markup. When you drag a control onto the page in WebForms, you expect it to work.

ScriptManager Basics

For example, if I'm going to do so stuff with GridView and an UpdatePanel, I might do this:













and this will cause some Web- and ScriptResources to be added to the generated HTML of my page, something like this:

 


Basically, ScriptResource.axd?d=blob&t=timestamp...these are JavaScript files that you don't need to deploy as they live inside the assemblies. They are managed by the ScriptManager tag/control in my source above.

Overriding ScriptResource and Hosting Static JavaScript Files

However, I might want to put them in static files and manage them myself. I can override their paths like this:







This will give me HTML like this:

 


NOTE: There're a few controls that don't use the ScriptManager, so they can't have their JavaScript suppressed. So far the Validators are the main culprits. I'm talking to the team and we'll see if we can't get that fixed in 4.0.

NEW IN 4.0: In 3.5 you also can't use the ScriptManager to suppress or set the path of WebResource.axd, but in 4.0 you will be able to by using ScriptReference. WebResource.axd is for non-Ajax scripts that use the Page.ClientScript.RegisterX APIs. It'll be nice to be able to use ScriptReference as the ScriptManager is smarter and gzip compresses as well.

In .NET 4.0 using the ScriptManager to suppress both ScriptResource and WebResource will allow you to get your pages down to a single script. We're looking also at a CDN (Content Distribution Network) option to get that static script hosted elsewhere as well. I'll show Script Combining in a second.

The name="" attribute has to line up with the name of the resource the script is stored in. I used Reflector to figure them out. There's a few like MicrosoftAjaxTimer.js, MicrosoftAjax.js, MicrosoftAjaxWebForms.js in System.Web.Extensions, and DetailsView.js, Focus.js, GridView.js, Menu.js, SmartNav.js, TreeView.js, WebForms.js, WebParts.js and WebUIValidation.js in System.Web.dll.

Remember, these ARE NOT ALL NEEDED. You only want these on an as-needed basis. When a control needs one, it'll ask for it. Just do a view-source on your resulting HTML and take control of the ones you want.

ScriptCombining in 3.5 SP1

Now, if I want to combine those 3 scripts into one, I can do this:









I've wrapped the scripts in a CompositeScript control and I get a single GZipped automatically combined script. I'll save that combined script away and host it at http://www.example.com/1.js statically. Now, I'll add the path attribute:









While not a direct feature of .NET 3.5, I'm able to greatly reduce the number of scripts and take control using a few simple techniques.

ScriptManager and CDNs in .NET 4.0

In .NET 4.0 we're trying to make this more formal and possibly get the page down to a single script that's hostable on a CDN. That will probably look something like this. Just enable CDN (Content Delivery Network) and all your ASP.NET Ajax scripts will come from a CDN that you can configure in global.asax once:

Pretty slick, and nicer than my hacks. For 4.0, the goal is for this to work with ScriptResource AND WebResource making your scripts quite tidy.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.