Micro Blogging, Scalability and Twitter#

I have been using Twitter lately and have really gotten into it.  I mostly use it with SMS from my palm treo 700w and have enjoyed the few people I actually follow and find great value in listening to the twitter of these people.  That being said, i have been really curious as to how this system is architected and since i work for a company that is creating a social network for sports among other things, i am fascinated on how to scale a social graph.  The problem seems to be with messaging and more critical the friends feed.  The scale and queries of finding what friends are up to can be a very tricky scalability problem.  I became even more fascinated with this after reading this post: Scaling a Microblogging Service

Also it is refreshing to hear from that actual developers that are creating this system: http://dev.twitter.com/2008/05/youve-got-qs-weve-got-as.html

For any of us that have created a site that actually needs to worry about scale can respect what it feels like when there is slow response or down time from your site.  It is fun and challenging, but sometimes is a thankless job.  For those of you that thrive on the passion of making a real cool service, I commend you and want to give thanks for fixing things that are not so easy to fix, but make the biggest impact system wide.  Those are usually the hardest to find.

Friday, May 30, 2008 9:19:40 AM UTC #    Comments [0]  |  Trackback

 

Moving from ASP.NET Webforms to ASP.NET MVC#

I am currently moving a project from a typical webforms project to the new asp.net mvc framework project.  I am already seeing some huge benefits that I wanted to share with others.  Of course there is no viewstate in asp.net mvc and this has its advantages.  The most significant change is the size of my home page.  the amount of text in the page is down over 40%.  so my home page was 32K and now it is only 18K.  I am noticing even quicker page response times also running locally and on the server.  The page just seems to render faster, especially when hitting the back button.  Also it just feels cleaner without all those controls and I can have 100% control of the html that spits out.  It reminds me of back in the classic asp and PHP days, but without all the pain.  I did not realize how much I missed just writing straight html without controls.  

At first I thought that it would slow me down and that I would have to write more code,  but I think the opposite is true.   I don't have to deal with code behind any more and I can test so much easier now the action that every form calls.  I was able to convert an existing website that had Ajax control toolkit, membership services and several contact forms in about a week.  Not even that if you counted the hours.  Not too bad.  These tutorials really helped me out: http://www.asp.net/LEARN/3.5-extensions-videos/#mvc

We are about ready to go into production with these bits as we see that it is very stable and since we have the source code to the entire framework in our source tree, it feels safe since we can always fix a bug in the framework if we need to.  You can get the source code here: ASP.NET MVC Preview 2 Source Code

Thursday, May 22, 2008 9:47:11 AM UTC #    Comments [0]  |  Trackback

 

Amazon Kindle back in Stock!#

Ever since I have seen the Kindle - wireless reading device , I have wanted to buy one and read the Pragmatic Programmer on it among many other books.  I am trying to figure out the best way to get my wife to agree that this is the thing I need.  I am thinking that maybe reading on it instead of the laptop in bed might be a good reason since this laptop is so bright when she is sleeping sometimes.  You know when you really want something that you have looked at it so many times, trying to find the one reason why you shouldn't get it, but you keep reading good review after good review.  Maybe I can win one at a conference or if I visualize that it is in my hand, it will just magically appear.  That would not be the first time that has happened.  It did with my Zune 80.

Monday, May 05, 2008 11:55:26 AM UTC #    Comments [0]  |  Trackback

 

JavaScript to Managed Code in Silverlight 2 Beta 1#

I had to solve an interesting problem the other day for our new Silverlight 2 chat app for our site.  People were closing the browser window and not clicking the leave chat button which clears out their chat session.  So we needed to find a way to close out their chat session.  There are several ways to solve this problem, write a windows service to clear out stale sessions among many others, but the real solution was to figure out a way to have a Silverlight function get called from JavaScript when they close the browser window.

So the first problem to solve is to catch the browser window close event in JavaScript.  Here is the the script you need to do just that on all 3 browsers, Firefox, IE and Safari.

<script type='text/javascript'>
        
        window.onbeforeunload = function() {
            var slCtl = document.getElementById("Xaml1"); 
            slCtl.Content.mySLapp.StopChatting();
            alert("You have been logged out");
        }

    </script>

The Xaml1 control is referencing the asp:Silverlight control that is on the page.  the slCtl.Content.mySLapp.StopChatting();  call is calling a method on my c# class in the silverlight project.  In order to make this work you will need to do two things in your silverlight project.  The first thing you need to do is to register managed code for client script access.  In the Application_Startup method in App.xaml.cs, call the RegisterScriptableObject() method on the HtmlPage object and pass in your type that you want to reference in your script.  Here is a sample of how to do it.

 
using System.Windows.Browser;

namespace Chat
{
    public partial class App : Application
    {

        public App()
        {
            this.Startup += this.Application_Startup;
            this.Exit += this.Application_Exit;
            this.UnhandledException += this.Application_UnhandledException;

            InitializeComponent();
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Load the main control
            this.RootVisual = new Page();

            //Setup some scriptable managed types for access from Javascript.
            ScriptableType st = new ScriptableType(); 
            HtmlPage.RegisterScriptableObject("mySLapp", st);

        }

        private void Application_Exit(object sender, EventArgs e)
        {

        }
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {

        }
    }
}
Now we need to create the ScriptableType class and add the ScriptableMemberAttribute 
attribute, which is required in order to expose the members to client script.
using System.Windows.Browser;

namespace Chat
{
    public class ScriptableType
    {
        public ServiceHandler svc;

        [ScriptableMember()]
        public void StopChatting()
        {
            svc = ServiceHandler.Instance;
            svc.StopChatting();
        }
    }
}
You can also return a type string if you want and then alert that string that is returned in JavaScript.
It really is a very powerful feature and I am very excited to use this power in many other ways. Happy coding!
Wednesday, April 30, 2008 11:12:40 AM UTC #    Comments [0]  |  Trackback

 

Building Visual Studio 2008 projects with TFS 2005#

When I upgraded to visual studio 2008, I tried to build out my 2008 project that was targeting 2.0 and it would not build out anymore because the version was not compatible with TFS 2005.  Turns out since there is a simple but irritating fix.  You need to open the .sln file in notepad and replace version 10.0 with 9.0 and then rename the file to a new one and use that in the build.  Remember to name it something different and then search and replace all the references to the old .sln to new one wherever it is referenced in the file.  Then be sure to remember to change the name of the .sln file in your tfsbuild.proj to point to the right sln.

Of course the better solution is to upgrade to TFS 2008, but that solution is not always the easiest because of money and time to upgrade the system. I am excited to upgrade soon, but this works for me now.

Monday, March 31, 2008 7:39:07 AM UTC #    Comments [1]  |  Trackback

 

Microsoft is going to give out dev tools for free to students#

I just saw on cnet news article tonight that Bill Gates is going to announce at Stanford on Tuesday, Feb. 19th that Microsoft will give away dev tools to college students and then high school students.   This is not just visual studio, but expression studio and even server 2003 and SQL dev edition.  Wow that is very cool and could help the shortage we have in developers in the U.S.

You can see more on this over at Channel 8 on this post http://channel8.msdn.com/Posts/2047/.    I am sure it will be all over the news in the morning.  This will change a lot in colleges across the world as the cost entry into learning and creating new .NET web applications and desktop apps just got very cheap and easier.  This will be very exciting to see the new apps that come out.

Tuesday, February 19, 2008 10:53:12 AM UTC #    Comments [5]  |  Trackback

 

Subsonic 2.1 Beta is Out#

SubSonic 2.1 Beta is Out.  Perfect timing.  I am speaking at South Florida Code Camp tomorrow morning on SubSonic and the future of it.  You can download the latest bits here on Codeplex.

Some really cool stuff coming out with SubSonic 2.1 including the Repository Pattern, SubStage, Linqy type queries with ASP.NET 2.0 and many bug fixes.  For people like me who have invested a lot of time with large projects and SubSonic, this is a very welcome release.  I cannot move many projects to 3.5 yet and this helps prolong the life of those projects without having to change any of the glue code that SubSonic helps so well with.

Saturday, February 02, 2008 9:48:09 AM UTC #    Comments [0]  |  Trackback

 

Tampa User Group Talk - ASP.NET Dynamic Data, Ajax and Silverlight using ASP.NET 3.5 Extensions Preview#

I am going to be doing a user group talk on January 28th 2008.  You will learn and see demos of some new data scenarios including MVC, ADO.NET Data Services, Dynamic data and the Entity Framework along with new Ajax history support and Silverlight controls for ASP.NET using the ASP.NET 3.5 Extensions Preview.  This release provides new features for ASP.NET 3.5 and ADO.NET in VS 2008.

Here are some good resources that you can tap into now and learn why this new stuff is so so cool.

I really hope that David Hayden shows up to keep me honest.  He is having also putting on an event called "Day of Patterns and Practices" on January 31st.  http://www.pnpguidance.net/  It should be a great event!

Friday, January 11, 2008 10:30:33 AM UTC #    Comments [0]  |  Trackback

 

 

All content © 2008, Jim Zimmerman
Book
New Book
Links to me
On this page
Sponsors
Calendar
<May 2008>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
Archives
Tags
Blogroll OPML
Technorati
Favorite Links
Disclaimer

Powered by: newtelligence dasBlog 1.9.6264.0

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

Send mail to the author(s) E-mail