Community Blogs

Browse by Tags

Related Posts

  • Best practices for using LINQ to SQL on your existing web applications.

    Previously I have been talking about the limitations of Linq to SQL for your data layer. You should read it here . This post is part of the Linq to SQL series . Linq to SQL is a great technology I found that adding the data layer on the web application will just work until you are deploying the application to another computer with another database. Mixing 2.0 Web app with 3.5 LINQ to SQL SavedDataContext context = new SavedDataContext (_ConnectionString); var result = from c in context.viewerContexts where c.UserID == userName select new { Name = c.Name, ID = c.ID, }; DataTable dt = new DataTable (); dt.Columns.Add( "ID" ); dt.Columns.Add( "Name" ); foreach ( var item in result) { DataRow row = dt.NewRow(); row[ "ID"...


  • Test Your NHibernate Mappings!

    A while back Bil Simser put up a post on the first test you should write when using Castle Windsor . In it he shows a technique for verifying his component registrations are correct. Since Windsor and NHibernate are the peanut butter and jelly of the ALT.NET crowd, I think we can and should do the same for NHibernate: [Test] public void Verify_NHibernate_mappings() { string myConfigPath = @"wherever\you\put\your\NHibernate\config.xml"; Configuration config = new Configuration(); _sessionFactory = config.Configure(nhibernateConfig).BuildSessionFactory(); } Would that I did this before today. Yeah, I win the douchey team member award for making a bunch of refactorings (renames mostly) and not fixing the mappings. Remember: Resharper...


  • Hook Methods

    I've written about the template method pattern before. For my money it's still a very useful pattern for building super lightweight frameworks and enabling the open-closed principle which states: Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. So let's review quickly what a template method looks like and what it can do for our code: public abstract class PriceCalculator { public Money Calculate(Product product) { Money retailPrice = GetRetailPrice(); Discount discount = CalculateDiscount(product); return discount.Apply(retailPrice); } public abstract Discount CalculateDiscount(Product product); public Rate GetRetailPrice() { //... } } public class GoldCustomerPriceCalculator...


  • Super Models, Part 1: Sexy Specifications

    In Domain-Driven Design we turn to the specification pattern when we want to check whether an object matches some criteria. I think specification is the oft-forgotten *** child pattern of the domain model pattern language. I know I frequently turn to queries -- sometimes query objects -- when I want to retrieve a set of some entity to work on. There are some major drawbacks to using queries. Namely there's a huge testing liability. Say we're using a technology like LINQ or NHibernate HQL or even SQL. Well our query and its various predicates that make up our "where clause" are tied up in a single monolithic statement, each of which needs testing. We end up reach deep into the bucket of compromise to find solutions to deal with...


  • How to add GeoTwitter to your blog or website

      You can add Geotwitter.NET to your website or blog with a simple JavaScript include and will provide two functions: You can see the last 10 users using Twitter the have a location as well as you can only show your last location. The code to add on your website is: <script type= "text/javascript" src= "http://geotwitter.net/Where.ashx" ></script> Has a few parameters that you can modify the size to fit your website   To change the the size you can use parameters Width and Height . <script type= "text/javascript" src=" http://geotwitter.net/Where.ashx?width=500&height=300 " ></script> You'll be required to create a key at Google Maps with the domain you are using...


  • iPhone support for GeoTwitter.Net

    I spent this shorts periods of free time this long weekend providing iPhone support to GeoTwitter , actually for a non UI person like me a little more difficult that I thought, still looking back to it, looks pretty crappy compared to other iPhone designs like Hahlo . The improvements in the new version already available at CodePlex includes; iPhone support including geolocations, allowing you to set the location by just entering the street, city, state, county. Saved in your profile until you change it. AutoLogin, if you check the Remember Me checkbox, every time you come back to geotwitter.net you'll be auto login into the system. Major code clean up and moved crappy code from pages to classes. The Google maps now open on the iPhone to...


  • Writing good performance web application for the masses. Twitter FAQ?

    I have recently being a twitter user, not proud that I become a user or better said a reader. I have blogged before about twitter , but after forcing myself to use it I have a much better opinion about such a service. I like to read some people’s microblogs at twitter. It’s like a big chat channel that you can filter the people that you see. In other words you create your own chat. Does not mean the person that you reading will be reading you back. Twitter is a great sample of a web application that should be fast and optimize for speed, the user load of twitter is huge, can be hundreds of updates a second from different clients and geographic locations. As you can see the big picture, you can start thinking about the great effort...


  • Who gets more replies on Twitter? GeoTwitter Alpha 0.3 available and running!

    Added a new feature requested that had nothing to do with geography but seemed pretty cool. I'll be keeping track of peoples replies to see who gets more replies on the public timeline. There is a delay on the public timeline, however hopefully in a few days we can tell who is in the lead. See report here to find out who gets more @replies. Note: You'll have to follow http://twitter.com/MVPs to be counted on the report. Also fixed a few bugs and started working in the new features to be able to use GeoTwitter on the iPhone. For a list of features go to the post series. The new release is up on CodePlex if you want to help, I need to clean up lots of code and design a much better database. Follow me at twitter for now. Cheers Al Read...


  • Debugging .NET Framework Source Code

    I am not sure how many people are familiar with the .NET Reference Source project, but if you do a lot of debugging of .NET code, chances are that you have had a situation where you wanted to be able to step into the .NET Source from within Visual Studio Read More......( read more ) Read More...


  • Don't wait for your Page_Load to finish if you don't have to.

    I spent many times answering this question at http://forums.asp.net , so I thought to put in a post the answer, so I can do a simple link. How to spoon a thread on the Page_Load so you don't have to wait for the page load rendering controls. Note: This is not for any control, this is for things like writing to a Log file or to a database. You won't be able to do anything where you need the server context. Add the code on the Page_Load to fire the method LogSomething in the background: protected void Page_Load( object sender, EventArgs e) { if (Page.IsPostBack == false ) { MyDelegate myDelegate = new MyDelegate(LogSomething); MyFireAndForget(myDelegate); } } define the internal class with the delegate information: class Info { internal...


Page 1 of 7 (64 items) 1 2 3 4 5 Next > ... Last ยป