Archives
-
ASP.NET: Serializing and deserializing JSON objects
ASP.NET offers very easy way to serialize objects to JSON format. Also it is easy to deserialize JSON objects using same library. In this posting I will show you how to serialize and deserialize JSON objects in ASP.NET.
-
Stream.CopyTo() extension method
In one of my applications I needed copy data from one stream to another. After playing with streams a little bit I wrote CopyTo() extension method to Stream class you can use to copy the contents of current stream to target stream. Here is my extension method.
-
ASP.NET and WIF: Showing custom profile username as User.Identity.Name
I am building ASP.NET MVC application that uses external services to authenticate users. For ASP.NET users are fully authenticated when they are redirected back from external service. In system they are logically authenticated when they have created user profiles. In this posting I will show you how to force ASP.NET MVC controller actions to demand existence of custom user profiles.
-
ASP.NET MVC: Using ProfileRequiredAttribute to restrict access to pages
If you are using AppFabric Access Control Services to authenticate users when they log in to your community site using Live ID, Google or some other popular identity provider, you need more than AuthorizeAttribute to make sure that users can access the content that is there for authenticated users only. In this posting I will show you hot to extend the AuthorizeAttribute so users must also have user profile filled.
-
ASP.NET: Including JavaScript libraries conditionally from CDN
When developing cloud applications it is still useful to build them so they can run also on local machine without network connection. One thing you use from CDN when in cloud and from app folder when not connected are common JavaScript libraries. In this posting I will show you how to add support for local and CDN script stores to your ASP.NET MVC web application.
-
Identifying AppFabric Access Control Service users uniquely
In my last posting about AppFabric Labs Access Control Service I described how to get your ASP.NET MVC application to work with ACS. In this posting I will dig deeper into tokens and claims and provide you with some helper methods that you may find useful when authenticating users using AppFabric ACS. Also I will explain you little dirty secret of Windows Live ID.
-
ASP.NET MVC 3: Using AppFabric Access Control Service to authenticate users
I had Windows Azure training this week and I tried out how easy or hard it is to get Access Control Service to work with my ASP.NET MVC 3 application. It is easy now but it was not very easy to get there. In this posting I will describe you what I did to get ASP.NET MVC 3 web application to work with Access Control Service (ACS). I will show you also some code you may find useful.
-
Comparing and updating database schemas using Visual Studio 2010
During development it is possible that database schema changes and usually it changes are same sure to come as tax office and death. Later we need to reflect these changes also to live databases and it is not very easy task to do manually. In this posting I will show you how Visual Studio 2010 database tools can help you to update database schema.
-
Deployable dependencies in Visual Studio 2010 SP1 Beta
One new feature that comes with Visual Studio 2010 SP1 Beta is support for deployment references. Deployment reference means that you can include all necessary DLL-s to deployment package so your application has all assemblies it needs to run with it in deployment package. In this posting I will show you how to use deployment dependencies.
-
Visual Studio 2010 SP1 Beta supports IIS Express
Visual Studio 2010 SP1 Beta and ASP.NET MVC 3 RC2 were both announced today. I made a little test on one of my web applications to see how Visual Studio 2010 works with IIS Express. In this posting I will show you how to make your ASP.NET MVC 3 application work with IIS Express.
-
SSAS: Using fake dimension and scopes for dynamic ranges
In one of my BI projects I needed to find count of objects in income range. Usual solution with range dimension was useless because range where object belongs changes in time. These ranges depend on calculation that is done over incomes measure so I had really no option to use some classic solution. Thanks to SSAS forums I got my problem solved and here is the solution.
-
Getting MySQL work with Entity Framework 4.0
Does MySQL work with Entity Framework 4.0? The answer is: yes, it works! I just put up one experimental project to play with MySQL and Entity Framework 4.0 and in this posting I will show you how to get MySQL data to EF. Also I will give some suggestions how to deploy your applications to hosting and cloud environments.
-
How one decision can turn web services to hell
In this posting I will show you how one stupid decision may turn developers life to hell. There is a project where bunch of complex applications exchange data frequently and it is very hard to change something without additional expenses. Well, one analyst thought that string is silver bullet of web services. Read what happened.
-
DLL-s needed to run ASP.NET MVC 3 RC on Windows Azure
In this weekend I made one of my new apps run on Windows Azure. I am building this application using ASP.NET MVC 3 RC and Razor view engine. In this posting I will list DLL-s you need to have as local copies to get ASP.NET MVC 3 RC run on Windows Azure web role.
-
Web publishing warning: "No element in the source document matches '/configuration/hibernate-configuration'"
I created web.config transform that changes NHibernate configuration for Windows Azure projects. When building publishing package I get the following warning: "No element in the source document matches '/configuration/hibernate-configuration'" and transformed configuration doesn’t contain expected changes. In this posting I will show you how to solve this problem.
-
Windows Azure: Debug and redeploy your web applications quickly
My previous posting about Windows Azure introduced how to access web role instances using Remote Desktop. In this posting I will show you how your web applications are stored in virtual server where instance is running and how to debug and redeploy your applications quickly.
-
Windows Azure: Connecting to web role instance using Remote Desktop
My last posting about cloud covered new features of Windows Azure. One of the new features available is Remote Desktop access to Windows Azure role instances. In this posting I will show you how to get connected to Windows Azure web role using Remote Desktop.
-
Silverlight 5 announced!
Just finished watching Silverlight Firestarter event where ScottGu made a keynote where he told about the future of Silverlight. There were some demos of Silverlight by SAP and IIS Media Server 4.0 new features by Chris Knowlton who demoed how to stream webcam pic to desktop, Windows Phone 7 and iPad. There was also demo about system called dayforce. But let’s go to new stuff now. In this postingI will introduce you fresh news I just got about Silverlight 5 new features.
-
Windows Azure - new portal, new services, new tools
New version of Windows Azure and Windows Azure Portal are now available with new set of tools and training kit. There are also some interesting betas available. In this posting I will introduce you new features of Windows Azure and show you new Windows Azure Portal. Also you will see the configuration of VM instance that runs web applications.
-
Draft: ASP.NET Web Pages with Razor Syntax
Microsoft published draft of e-book ASP.NET Web Pages with Razor Syntax - Beta 3. The book is targeted to everybody who want to build web sites with WebMatrix or Visual Studio using Razor engine. The book is simple and very informative and I already found some interesting topics from it. If you are starting with Razor take a look at this book.
-
Quick introduction to Pex
Pex and Moles is new testing and code analysis technology that is created by Microsoft Research. Pex is powerful tool that helps you analyze your code, detect error situations and generate parameterized unit tests. In this posting I will give you quick and illustrated overview of Pex.
-
ASP.NET MVC: Comparing same view on ASP.NET and Razor view engine
I ported views of my ASP.NET MVC application from ASP.NET to Razor. Although Razor is very new it is very promising view engine because of shorter and cleaner syntax. In this posting I will show you same view on ASP.NET and Razor view engine. I like Razor one more but what do you think?
-
ASP.NET: How to avoid ArgumentNullException in StructureMap controller factory
I am using StructureMap as my IoC container. In my ASP.NET MVC web application I have controller factory based on StructureMap. I found interesting problem – when running my web application on development web server I get ArgumentNullException with every request to some controller action. In this posting I will describe why it is happening and how to avoid it.
-
CodePlex supports Windows Live Writer!
I am documenting local community portal that is hosted in CodePlex. Wikis have always been annoying for me when it comes to creating a good content. So, I was preparing for boring evening full of wiki mark-up and messing with good format, manual image uploads etc. But CodePlex surprised me today – it’s wiki supports Windows Live Writer!
-
ASP.NET MVC 3: Updating controller factories to RC
With ASP.NET MVC 3 RC there is change in IControllerFactory interface. This interface includes new method called GetControllerSessionBehavior(). This method returns value from SessionStateBehavior enum. ASP.NET MVC uses this method to find out how to handle session for given controller.
-
SharePoint: Setting master page for publishing sites
I am upgrading local community portal from SharePoint Server 2007 to SharePoint Server 2010. I also have to write deployment scripts so other guys can also use our codebase. One thing my deployment script has to do is to force correct master pages to sites. There is one little trick you should know when setting master pages for publishing webs. Here’s how I got things work.
-
Creating Twitpic client using ASP.NET and OData
Open Data Protocol (OData) is one of new HTTP based protocols for updating and querying data. It is simple protocol and it makes use of other protocols like HTTP, ATOM and JSON. One of sites that allows to consume their data over OData protocol is Twitpic – the picture service for Twitter. In this posting I will show you how to build simple Twitpic client using ASP.NET.
-
Sinergija10 - We were all in (Beograd, Srbija)
This week I visited conference called Sinergija10 that took place in Belgrade, Serbia. Thanks to Microsoft Estonia who organized my trip there! Sinergija10 was very good surprise to me and I am really considering it as one of Microsoft’s top conferences in Europe. Yes, I think it is at least same cool conference as TechEd EMEA. Here is my overview of event and some of my thoughts about Sinergija and communities in area. For guys who are planning to visit Europe events I think Sinergija is event to visit for sure.
-
Free e-book: Moving to Visual Studio 2010
Those who are still using older versions of Visual Studio may find the free e-book “Moving to Microsoft Visual Studio 2010” useful when deciding if it is time to move to Visual Studio 2010 or not. The book is written by Ken Haines, Pascal Paré and Patrice Pelland who all work in Microsoft Consumer and Online Division.
-
How to dump object properties
I needed a quick’n’dirty way to inspect objects returned from external source. I wrote simple object properties dumping mechanism you can use to investigate unknown objects. It is really quick and really dirty.
-
Visual Studio: How to include missing namespaces
Some of my readers have problem with detecting correct namespaces to include in code samples. Here is how to get references in place using Visual Studio IDE.
-
WCF: The maximum message size quota for incoming messages (65536) has been exceeded
When using WCF services you may get the following error: "The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element." This error is given because of size limits set to responses in your application configuration.
-
What is Visual Studio Async?
During PDC10 Anders Hejlsberg announced Visual Studio Async CTP when speaking about new stuff in C# and VB.NET next versions. In this posting I will introduce the background of Visual Studio Async and I will provide you with links to different resources so you can get started immediately.
-
ASP.NET MVC 3: Building simple image editor using WebImage helper
In my previous posting about WebImage helper I introduced how to use WebImage for different image manipulations. In this posting I will show you how to build simple online image editor using WebImage helper.
-
ASP.NET MVC 3: Using global action filters to find out running time of controller actions
Lately I blogged about global action filters in ASP.NET MVC 3. Yesterday I found cool article from Nick Berardi’s Coder Journal where he introduces how to use action filters to measure running time of ASP.NET MVC controllers. And here is my experiment – how to use global action filters to find out how long controller actions are running. You just need couple of lines of code.
-
Deploying ASP.NET MVC 3 web application to server where ASP.NET MVC 3 is not installed
When I wrote my last posting about jQuery Mobile and ASP.NET MVC. I built my sample application on ASP.NET MVC 3. To try it out with friends I put my application up to my web server where I don’t have ASP.NET MVC 3 installed. In this posting I will tell you what files you need and where you can find them.
-
Building mobile web site with ASP.NET MVC and jQuery Mobile
jQuery Mobile is unified UI system that will work on all popular mobile device platforms. Currently alpha version is available to download. In this posting I will show you how to use jQuery Mobile with ASP.NET MVC 3 and how jQuery Mobile pages look on Windows Mobile.
-
SQL Server: How to insert million numbers to table fast?
Yesterday I attended at local community evening where one of the most famous Estonian MVPs – Henn Sarv – spoke about SQL Server queries and performance. During this session we saw very cool demos and in this posting I will introduce you my favorite one – how to insert million numbers to table.
-
ASP.NET MVC 3 Beta: Using WebMail helper to send e-mail
This far I have blogged about WebImage and Chart helpers. Now let’s see another new helper – WebMail – that you can easily use to send e-mails. WebMail is easy to configure and extremely easy to use. In this posting I will show you simple feedback form that uses WebMail to send feedback messages.
-
ASP.NET MVC 3 Beta: Razor views support comments now
Sometimes we need server-side comments in ASP.NET MVC views. New version of Razor view engine supports comments in views and in this posting I will show you example of view with multiline comments.
-
ASP.NET MVC 3 Beta: Simple image manipulations using WebImage helper
First new helper in ASP.NET MVC 3 Beta I blogged about was chart helper. In this posting I will introduce you another cool helper that is called WebImage and that provides you with image manipulation functions. Also this helper is made for web and instead of messing with more complex GDI+ functions you can do a lot of stuff with images very easily.
-
ChartResult: Testable ASP.NET MVC 3 controller actions that return Chart
Lately I blogged about charts support in ASP.NET MVC 3 beta. This posting showed how to get chart initialized and sent to client quickly. In this posting I will show you how to use Chart with ChartResult to make our chart operations testable.
-
ASP.NET MVC 3 Beta: Strongly-typed views in Razor
One of the new features of Razor view engine is support for strongly-typed models. In this posting I will show you how to use strongly-typed model with Razor using simple view page.
-
ASP.NET MVC 3 Beta: View start files for Razor view engine
To follow better DRY (Don’t Repeat Yourself) principle Razor views support now defaults that are applied to all views in ASP.NET MVC web application. Default can be applied by special file so you have one place where everything common is defined. In this posting I will show you how defaults work and how to use them.
-
ASP.NET MVC 3 Beta: Caching charts
In my previous posting about charts in ASP.NET MVC 3 I gave you basic idea about how to use them. In this posting I will show you something cool – we will optimize performance of our application by caching charts so we don’t have to generate them on every request.
-
ASP.NET MVC 3 Beta: Built-in support for charts
ASP.NET MVC does not have built-in support for chart control and that’s why I worked out my own solution to make ASP.NET MVC support chart control. With ASP.NET MVC 3 we will get official support for charts right out of the box. In this posting I will show you how to use charts in ASP.NET MVC 3 Beta.
-
NuPack, ASP.NET MVC 3 Beta and WebMatrix Beta 2 are here!
Some great news from Microsoft dudes – NuPack, ASP.NET MVC 3 Beta and WebMatrix Beta 2 are here! Seems like busy weekend is coming. Here you can find download links to new versions of products.
-
Bing Maps: Adding and tracking pushpins using JavaScript
I played with Bing Maps AJAX-based API and found it to be very easy to use after you know basic objects and you are able to use them. In this posting I will show you simple example about how to add pushpins to map and how to show coordinates of pushpins to users.
-
Announcing public source code repository with my blog samples
My blog is about three years old and I must they that it has been very interesting and exciting time with you, guys! Now it is time to add something new to make it easier for you to use this blog and the knowledge you can find here. This posting is specially dedicated to all my frequent readers and if you are one of them then your feedback to me is extremely important to me. Now, let’s go to topic – better availability of sample code is coming soon!
-
ASP.NET MVC: Using asynchronous controller to call web services
Lately I wrote about how to make a lot of asynchronous calls to web services during ASP.NET page processing. Now it’s time to make same thing work with ASP.NET MVC. This blog post shows you how to use asynchronous controllers and actions in ASP.NET MVC and also you will see more complex scenario where we need to gather results of different web service calls to one result set.
-
Using MemBus for messaging between application components
Sometimes we need publisher/subscriber messaging in our applications to broadcast messages to different parts of system in real time. We can always build our own solution for this but we can also use something that is already there. In this posting I will show you how to use MemBus to send messages from MDI parent form to MDI child forms.
-
Unity, Castle Windsor, StructureMap, Ninject – who has best performance?
I made quick comparison of performance of four DI/IoC containers. I measured Unity, Castle Windsor, StructureMap and Ninject in two scenarios – resolving objects with empty constructor and resolving object with injected parameters in its constructor. Results are here.
-
Generating data for tables in table per class inheritance tree using data generation plans
I am using Visual Studio database project and data generation plan to populate my database with random data. In my database there are some tables for table per class inheritance mapping and there are some additional steps required to get these tables filled with data correctly. In this posting I will describe the process of generating data for table per class inheritance tables and give you some hints how to make this data valid for O/R-mappers.
-
Returning paged results from repositories using PagedResult<T>
During my large database experiment I wrote simple solution for paged queries that I can use in my repositories. This far my experiments have shown pretty good results and I think it is time to share some of my code with you. In this posting I will show you how to create paged results using NHibernate and Entity Framework based repositories.
-
Using timer based Unit of Work and Command classes to measure repositories performance
In my last post Find out how long your method runs I introduced how to measure the speed of code using actions. In this posting I will make a step further and give you some ideas about how to create easily measurable code units and how to build measurable scenarios of them. As a foundation I use simplified versions of patterns like Command and Unit of Work.
-
Find out how long your method runs
I am making some experiments with large database and different O/R-mappers. To make it easier for me to measure the time that code takes to run I wrote simple command class that uses Stopwatch class and measures how long it takes for action to run. I this posting I will show you my class and explain how to use it.
-
Experiment: List<T> internals and performance when adding new elements
Lists and their performance has been hot discussion topic for years. I have seen many examples and read a lot of stories about List class and I made conclusion that there is too much pointless opinions about it. In this posting I will show you how List<T> performs when adding elements to it and how it works internally. Be prepared for interesting discussion!
-
Common mistakes made when measuring the speed of code
During times I have seen problematic ways how developers measure the speed and performance of their code. There are some easy tricks that help you make your measurements way better and accurate comparing to measurements made not so well. In this posting I will give you some hints how to get more accurate results when measuring the speed of your code.
-
Making asynchronous calls to web services during ASP.NET page processing
Some ASP.NET web applications use web services to get some data that they display to users. Some pages may lay hardly on web services and these pages need some optimization to work better. In this posting I will show you how to use web services behind your ASP.NET page asynchronously and perform a lot of queries to web services. Sample code included!
-
Visual Studio Extension: Save UML diagram as image
I am auditing one big legacy application. I use Visual Studio 2010 modeling projects to visualize the design of this legacy application. When I wanted to get my UML diagrams to image files so I can insert them to documents I found no option for it. As it turned out we have to write extension for modeling projects and deploy it as Visual Studio 2010 extension. Here is the installer and source package of my UML.SaveAsImage extension.
-
Adding Twitter authentication support to ASP.NET application
In my last posting I introduced my idea about common membership provider for ASP.NET that is able to support multiple authentication providers. Before writing membership provider we need support for some authentication providers to get an better idea how to use them together. In this posting I will introduce you how to use OAuth protocol with Twitter.
-
Planning common membership provider for different authentication providers
I am trying to implement form based authentication (FBA) membership provider that is able to support multiple authentication mechanisms. Take it as an self-training experiment. In this posting I will introduce bases of my experiment and introduce my current plans and ideas.
-
Visual Studio: Microsoft should simplify producing quality software
I am looking at features of different versions of Visual Studio and I less and less understand how and why is the quality of software handled as fun of few seasoned professionals. Although Visual Studio is best development platform I have ever seen I really don’t understand why Microsoft hates people who want to provide quality to their customers.
-
Book review: Patterns of Enterprise Application Architecture
-
Managing business object locks on application level
Today I worked out simple application side object locking solution for one server scenario. My motivation came from ASP.NET architecture forum thread How to solve concurrent site issue where one user asks for locking solution that works without changing database. Here is my simple and primitive solution that should help this guy out. I added also sample solution to this posting.
-
ASP.NET MVC meets HTML5
Today I tried out ASP.NET MVC HTML5 Helpers Toolkit by Dean Hume. Although browsers today support HTML5 partially it is time to start playing with it. As soon as HTML5 gets common standard in web you should be able to react fast. In this posting I will introduce you HTML5 Helpers Toolkit and some HTML5 field types.
-
ASP.NET MVC 3: Using HttpNotFoundResult in controller tests
Lately I blogged about HttpNotFoundResult and HttpStatusCodeResult action results that come with ASP.NET MVC 3. These results are ideal for controller tests as we don’t have to mess with HttpContext and Response objects anymore. In this posting I will show you how to use HttpNotFoundResult in controller tests to check if errors are given correctly to user.
-
ASP.NET MVC 3: Introducing Razor view engine
ASP.NET MVC 3 brings us new view engine called Razor. Razor view engine was made available with WebMatrix first beta. Razor brings us new and very short syntax for writing views. In this posting I will introduce you shortly ASP.NET MVC Razor view engine.
-
ASP.NET MVC 3: Global action filters
ASP.NET MVC 3 supports global action filters. Global action filters are applied to all actions in web application. By example, you can use global action filters for common security checks. In this posting I will show you how to write dummy action filter, register it as global and test it.
-
Example: Creating workflow to request songs from radio station
Today I played with WF 4.0 declarative workflows. This posting shows you simple workflow that you can extend to add songs to online radio station queue. My main focus here is workflow and I will provide here no logic for actual queue implementation. You can find here also Visual Studio 2010 sample solution.
-
There is no context attached to the incoming message for the service and the current operation is not marked with "CanCreateInstance = true"
I got this error when testing my example WF 4.0 workflow that runs on WCF. To get over this error just open your workflow, select Receive activity and make check to checkbox called CanCreateInstance (click on image at right to see it at original size).
-
ASP.NET MVC 3: Using multiple view engines in same project
One of nice features of ASP.NET MVC 3 is support for multiple view engines. There will be two out-of-box view engines: one for classic ASPX-based views and one for Razor-based views. In this posting I will show you this new feature and demonstrate how to use different view engine in same project.
-
ASP.NET MVC 3: Creating HttpStatusCodeResult with view based body
My last posts described new action results in ASP.NET MVC 3 – HttpNotFoundResult and HttpStatusCodeResult. Unfortunately these result have no body to send to client but there are times we need it to inform our visitor about problems the way that we don’t go out of information context where visitor is. In this example I will show you how to write your own HttpStatusCodeResult that has also body.
-
ASP.NET MVC 3: Using HttpStatusCodeResult
ASP.NET MVC 3 also introduces new action result HttpStatusCodeResult. This action result provides you way how to specify HTTP status code and status description in your controllers. In this posting I will show you how to use HttpStatusCodeResult in your real-world applications providing meaningful status code for products that were online once but are now gone and we don’t expect them to be back in future.
-
Overview of my MVP year
Another MVP year is over. Today I sent my activity report to my MVP lead and in October it should be clear if my MVP will be continued or not. I hope it will continued, of course. Now it is time to make one little overview about my MVP year that just ended in terms of public activities. It was year full of action and interesting people – something that is hard to forget. You should be proud too – without you there is no MVP program, this blog and many other things. So, feel yourselves as part of action!
-
ASP.NET MVC 3: New ViewModel is dynamic ViewData
ASP.NET MVC 3 introduces new ViewModel property of Controller that you can use to assign different properties to the model of your view. ViewModel is dynamic by type. In this posting I will show you how to use ViewModel property in your ASP.NET MVC applications.
-
ASP.NET MVC 3: Using HttpNotFoundResult action result
ASP.NET MVC 3 introduces some new action results like HttpNotFoundResult that you can use to let browser know that resource was not found. In this posting I will show you how to use HttpNotFoundResult in real-world applications.
-
ASP.NET MVC 3 Preview 1 is released!
ASP.NET MVC 3 Preview 1 is launced and available for download. There are many cool features and I strongly suggest you to try the new version out. In this posting I will give you quick overview about what’s new in ASP.NET MVC 3.
-
How to make AJAX-requests to ASP.NET MVC application using jQuery
I decided to write over long time one posting that is directed to beginners who start with jQuery and AJAX. One of the first things to study is how to make requests to server and how to retrieve objects. In this posting I will show you how to use jQuery to retrieve JSON data from ASP.NET MVC application and how to debug it.
-
ASP.NET MVC: Using dynamic type to test controller actions returning JsonResult
I wrote unit tests for my ASP.NET MVC application that uses some jQuery AJAX-components. These components load data from server in JSON format. I needed to write tests for these methods to make sure that correct data is returned to client. In this posting I will show you how to use dynamic type to test JSON-based action results and therefore avoid creating DTO classes.
-
Solution Navigator: Killer replacement for Solution Explorer
Visual Studio 2010 Productivity Power Tools contains now Solution Navigator that merges many good features of Visual Studio 2010, Solution Explorer and some Power Tools features to single view. After playing shortly with Solution Navigator I found it to be very good replacement for Solution Explorer. In this posting I will show you some very cool features of Solution Navigator.
-
WebMatrix Beta in pictures
Long time ago there was simple ASP.NET editor called Web Matrix that was replaced by Visual Web Developer Express when Express versions came for Visual Studio. Now is time again for some small and easy tool and here it is – Microsoft WebMatrix Beta. In this posting I will introduce you Microsoft WebMatrix and show how it works.
-
Stepping into ASP.NET MVC source code with Visual Studio debugger
Using Visual Studio symbols and source files makes debugging much easier. I am specially happy about ASP.NET MVC 2 source files because I develop on ASP.NET MVC 2 almost every day. You may also find other useful symbols and source files. In this posting I will show you how to get ASP.NET MVC source to your computer and how to use it.
-
ASP.NET MVC: MVC Time Planner is available at CodePlex
I get almost every week some e-mails where my dear readers ask for source code of my ASP.NET MVC and FullCalendar example. I have some great news, guys! I ported my sample application to Visual Studio 2010 and made it available at CodePlex. Feel free to visit the page of MVC Time Planner.
-
Using ExcelPacke to create Excel sheets on server
In one of my community projects I needed to output some listings as Excel file. As installing Excel to server is non-sense that I was easily able to avoid I found simple solution for Excel 2007 files – open-source project called ExcelPackage. In this posting I will show you hot to create simple event attendees report in Excel 2007 format using ExcelPackage.
-
JavaScript: Creating timestamps with time zone offsets
I was converting the example code of my Windows Azure session to Visual Studio 2010 solution called MVC Time Planner when I discovered some date and time offset issues in my JavaScript code. In this posting I will show you some useful tricks you can use to convert JavaScript dates and times to timestamps.
-
Code Contracts: validating arrays and collections
Validating collections before using them is very common task when we use built-in generic types for our collections. In this posting I will show you how to validate collections using code contracts. It is cool how much awful looking code you can avoid using code contracts.
-
Clean Code: A Handbook of Agile Software Craftsmanship – book review
-
ASP.NET: Using pickup directory for outgoing e-mails
Sending e-mails out from web applications is very common task. When we are working on or test our systems with real e-mail addresses we don’t want recipients to receive e-mails (specially if we are using some subset of real data9. In this posting I will show you how to make ASP.NET SMTP client to write e-mails to disc instead of sending them out.
-
Code Contracts: How they look after compiling?
When you are using new tools that make also something at code level then it is good idea to check out what additions are made to code during compilation. Code contracts have simple syntax when we are writing code at Visual Studio but what happens after compilation? Are our methods same as they look in code or are they different after compilation? In this posting I will show you how code contracts look after compiling.
-
ASP.NET MVC: Using jQuery context menu with tables
I needed to add context menus to some tables of my intranet application. After trying some components I found one that does everything I need and has no overhead. In this posting I will show you how to use jQuery context menu plug-in and how to attach it to tables.
-
Creating vCard action result
I added support for vCards to one of my ASP.NET MVC applications. I worked vCard support out as very simple and intelligent solution that fits perfectly to ASP.NET MVC applications. In this posting I will show you how to send vCards out as response to ASP.NET MVC request.
-
Using Sandcastle to build code contracts documentation
In my last posting about code contracts I showed how code contracts are documented in XML-documents. In this posting I will show you how to get code contracts documented with Sandcastle and Sandcastle Help File Builder.
-
Code Contracts
Code contracts is interesting topic to discover for me. Although it is new technology that is currently the lab rat of DevLabs it looks still very promising and useful. In this page you can find my postings about code contracts, references to other useful resources and download links to my presentation and example solution.
-
Enabling XML-documentation for code contracts
One nice feature that code contracts offer is updating of code documentation. If you are using source code documenting features of Visual Studio then code contracts may automate some tasks you otherwise have to implement manually. In this posting I will show you some XML documentation files with documented contracts. I will also explain how this feature works.
-
Code Metrics: Number of IL Instructions
In my previous posting about code metrics I introduced how to measure LoC (Lines of Code) in .NET applications. Now let’s take a step further and let’s take a look how to measure compiled code. This way we can somehow have a picture about what compiler produces. In this posting I will introduce you code metric called number of IL instructions.
-
MSSQL: Copying data from one database to another
I have database that has data imported from another server using import and export wizard of SQL Server Management Studio. There is also empty database with same tables but it also has primary keys, foreign keys and indexes. How to get data from first database to another? Here is the description of my crusade. And believe me – it is not nice one.
-
F# in ASP.NET, mathematics and testing
Starting from Visual Studio 2010 F# is full member of .NET Framework languages family. It is functional language with syntax specific to functional languages but I think it is time for us also notice and study functional languages. In this posting I will show you some examples about cool things other people have done using F#.
-
Code contracts and inheritance
In my last posting about code contracts I introduced you how to force code contracts to classes through interfaces. In this posting I will go step further and I will show you how code contracts work in the case of inherited classes.
-
Invariant code contracts – using class-wide contracts
It is possible to define invariant code contracts for classes. Invariant contracts should always hold true whatever member of class is called. In this posting I will show you how to use invariant code contracts so you understand how they work and how they should be tested.
-
Interface contracts – forcing code contracts through interfaces
Sometimes we need a way to make different implementations of same interface follow same rules. One option is to duplicate contracts to all implementation but this is not good option because we have duplicated code then. The other option is to force contracts to all implementations at interface level. In this posting I will show you how to do it using interface contracts and contracts class.
-
Code Contracts: Unit testing contracted code
Code contracts and unit tests are not replacements for each other. They both have different purpose and different nature. It does not matter if you are using code contracts or not – you still have to write tests for your code. In this posting I will show you how to unit test code with contracts.
-
Windows Phone 7 development: Using isolated storage
In my previous posting about Windows Phone 7 development I showed how to use WebBrowser control in Windows Phone 7. In this posting I make some other improvements to my blog reader application and I will show you how to use isolated storage to store information in phone.
-
Code Contracts: Hiding ContractException
It’s time to move on and improve my randomizer I wrote for an example of static checking of code contracts. In this posting I will modify contracts and give some explanations about pre-conditions and post-conditions. Also I will show you how to avoid ContractExceptions and how to replace them with your own exceptions.
-
Using runtime checking of code contracts in Visual Studio 2010
In my last posting about code contracts I introduced how to check input parameters of randomizer using static contracts checking. But you can also compile code contracts to your assemblies and use them also in runtime. In this posting I will show you simple example about runtime checking of code contracts.
-
How to configure Visual Studio 2010 code coverage for ASP.NET MVC unit tests
I just got Visual Studio 2010 code coverage work with ASP.NET MVC application unit tests. Everything is simple after you have spent some time with forums, blogs and Google. To save your valuable time I wrote this posting to guide you through the process of making code coverage work with ASP.NET MVC application unit tests.
-
Example: Controlling randomizer using code contracts
One cool addition to Visual Studio 2010 is support for code contracts. Code contracts make sure that all conditions under what method is supposed to run correctly are met. Those who are familiar with unit tests will find code contracts easy to use. In this posting I will show you simple example about static contract checking (example solution is included).
-
Windows Phone 7 development: Using WebBrowser control
In my posting Windows Phone 7 Series development: reading RSS feeds I showed how to read RSS feeds using XmlReader. Although I hoped to start pimping up user interface I found some more work that needs to do be done. In this posting I will show you how to use WebBrowser control to display RSS content. Example solution is also here for download.
-
Why Software Sucks...and What You Can Do About It – book review
-
Agile Database Techniques: Effective Strategies for the Agile Software Developer – book review
-
ASP.NET: Using conditionals in data binding expressions
ASP.NET 2.0 has no support for using conditionals in data binding expressions but it will change in ASP.NET 4.0. In this posting I will show you how to implement Iif() function for ASP.NET 2.0 and how ASP.NET 4.0 solves this problem smoothly without any code.
-
Measuring ASP.NET and SharePoint output cache
During ASP.NET output caching week in my local blog I wrote about how to measure ASP.NET output cache. As my posting was based on real work and real-life results then I thought that this posting is maybe interesting to you too. So here you can read what I did, how I did and what was the result.
-
How to avoid the exception “Substitution controls cannot be used in cached User Controls or cached Master Pages.”
Recently I wrote example about using user controls with donut caching. Because cache substitutions are not allowed inside partially cached controls you may get the error Substitution controls cannot be used in cached User Controls or cached Master Pages when breaking this rule. In this posting I will introduce some strategies that help to avoid this error.
-
Quick example: why coding standards must be in place
One quick example why coding standards must be in place. Take a look at the following code – property names are changed but not anything else.
-
Windows Phone 7 Series development: reading RSS feeds
One limitation on Windows Phone 7 is related to System.Net namespace classes. There is no convenient way to read data from web. There is no WebClient class. There is no GetResponse() method – we have to do it all asynchronously because compact framework has limited set of classes we can use in our applications to communicate with internet. In this posting I will show you how to read RSS-feeds on Windows Phone 7.
-
Windows Phone 7 Series development: first impressions
After hard week in work I got some free time to play with Windows Phone 7 CTP developer tools. Although my first test application is still unfinished I think it is good moment to share my first experiences to you. In this posting I will give you quick overview of Windows Phone 7 developer tools from developer perspective.
-
Exam 70-541 - TS: Microsoft Windows SharePoint Services 3.0 - Application Development
Today I passed Microsoft exam 70-541: Microsoft Windows SharePoint Services 3.0 - Application Development. This exam gives you MCTS certificate. In this posting I will talk about the exam and also give some suggestions about books to read when preparing for exam.
-
Entity Framework 4.0: Creating objects of correct type when using lazy loading
In my posting about Entity Framework 4.0 and POCOs I introduced lazy loading in EF applications. EF uses proxy classes for lazy loading and this means we have new types that come and go dynamically in runtime. We don’t have these types available when we write code but we cannot forget that EF may expect us to use dynamically generated types. In this posting I will give you simple hint how to use correct types in your code.
-
Advanced donut caching: using dynamically loaded controls
Yesterday I solved one caching problem with local community portal. I enabled output cache on SharePoint Server 2007 to make site faster. Although caching works fine I needed to do some additional work because there are some controls that show different content to different users. In this example I will show you how to use “donut caching” with user controls – powerful way to drive some content around cache.
-
Entity Framework 4.0: Optimal and horrible SQL
Lately I had Entity Framework 4.0 session where I introduced new features of Entity Framework. During session I found out with audience how Entity Framework 4.0 can generate optimized SQL. After session I also showed guys one horrible example about how awful SQL can be generated by Entity Framework. In this posting I will cover both examples.
-
Exam 70-448 - TS: Microsoft SQL Server 2008, Business Intelligence Development and Maintenance
The another exam I passed was 70-448 - TS: Microsoft SQL Server 2008, Business Intelligence Development and Maintenance. This exam covers Business Intelligence (BI) solutions development and maintenance on SQL Server 2008 platform. It was not easy exam, but if you study then you can do it.
-
Exam 70-630 - TS: Microsoft Office SharePoint Server 2007, Configuring
It has been really quiet here but I wasted no time. I passed exam 70-630 - TS: Microsoft Office SharePoint Server 2007, Configuring and in this posting I will give you a short overview of this very-very easy exam.
-
Who is code wanderer?
In every area of life there are people with some bad habits or misbehaviors that affect the work process. Software development is also not free of this kind of people. Today I will introduce you code wanderer.
-
Notes from Rafal Lukawiecki business analysis sessions
Last week Rafal Lukawiecki visited Estonia and I was lucky enough to find time for two sessions in my pretty tight schedule. All Rafal’s sessions were about Business Intelligence (BI) at Microsoft platform. This posting contains few notes I made for myself. Maybe you can find some interesting facts here too.
-
The Mythical Man-Month – book review
-
Using Orca to manage MSI packages
There are many programs that come with MSI installer and not every installer is free of bugs or small problems. If you are building your own installer using Visual Studio you may want to change it before publishing it to users. Here is little overview of my main free tool called Orca.
-
Some e-books and .NET 4.0 beta exams
Lately I have found some pretty interesting e-books about different technologies and one announcement about .NET Framework 4.0 beta exams. In this posting I will introduce you books I found and first beta exams.
-
Simple pager for ASP.NET MVC
I needed simple pager for one of my ASP.NET MVC projects. I mean really simple pager – no new types my code should be aware of, no any other chemistry I don’t really need in early stages. As ASP.NET MVC has nothing to offer I wrote my own *really simple* pager implementation. Here is what I did.
-
Code Metrics: Measuring LoC in .NET applications
My previous posting gave quick overview of code metric called Lines of Code (LoC). In this posting I will introduce you how to measure LoC in Visual Studio projects using Visual Studio Code Analysis and NDepend.
-
Code Metrics: Lines of Code (LoC)
I started writing series of blog posting about code metrics. I plan to introduce different metrics and explain their meaning. Also I plan to introduce tools you can use to measure those metrics. Where possible I will introduce you how to use one or another metric. The first metric is the simplest one and it is called Lines of Code (LoC).
-
My object to object mapper source released
Some readers asked me for Visual Studio project of my simple object to object mapper. I am glad to announce that the source code of my mapper is now available for download. It is Visual Studio 2008 project written on C# and besides mapper implementation it contains primitive sample application that shows you how to use my mapper.
-
User controls should never make redirects during GET request
Why is my page redirecting me back to front page although it gets all the data it requires? I was going out of my mind when exploring the problem in one system but this time there was really simple answer: you cannot fully trust the code written by n00bs. Okay, here is my story. :)
-
Writing object to object mapper: my mapper vs AutoMapper
As my object to object mapper is now almost completed and I am sure it is good idea to stay on LCG (Lightweight Code Generation) I can now compare the performance of my mapper to AutoMapper.
-
Writing object to object mapper: moving to generics
In my previous posting about object to object mapping Writing object to object mapper: first implementations I wrote first and simple implementations of mapper. These implementations based heavily on reflection. In this posting I will boost up mapper performance by using generics.
-
Visual Studio 2010 RC is available
VS2010 RC is out now and available for MSDN users since now. Other guys have to wait until tomorrow when VS2010 RC is made publically available. Reading first news I discovered that most important thing is improved performance of VS2010 RC IDE. All your feedback is welcome to VS2010 RC Connect site.
-
IL perversions: throwing and catching strings
Inspired by Mohamed Mahmoud’s blog posting How to: Create Interfaces with Static Methods via IL? I wrote another sick example on IL (Intermediate Language) to show you how different is the world behind compilers. Tonight I have enough of exceptions, I want to throw some strings! Let’s do it!
-
Writing object to object mapper: first implementations
I wrote some object to object mapping code and introduced it in some of my previous postings about performance. As I received 22x performance raise when trying out different mapping methods and it is now time to make my code nice. In this posting I will show you how I organized my code to classes. Yes, you can use my classes in your work if you like. :)
-
ASP.NET MVC Performance II: Optimizing resources
In my previous posting about ASP.NET MVC performance I showed you how to combine resources like scripts, style sheets and images. In this posting I will show you how to minimize resources so we don’t waste the bandwidth we got.
-
ASP.NET MVC Performance I: Combining resources
I wrote a small postings series about how to optimize ASP.NET MVC applications. This posting is small introduction to series and it also introduces first two optimization steps: resources and images combining.
-
Performance: Using LCG to copy property values of two objects
Today I gave last performance boost to my property values copying mechanism. I would like to thank my readers Ron and David to remind me Lightweight Code Generation (LCG) and pointing me out aussie bloke blog entry Generic copy object using Lightweight Code Generation. In this posting I will show you last performance boost and put down a summary about my experiment this far.
-
Using FullCalendar jQuery component with ASP.NET MVC
I found very good jQuery component called FullCalendar. My special favorites are agenda views because they make this calendar really useful in business applications. In this posting I will show you how to use FullCalendar with ASP.NET MVC.
-
Performance: Using dynamic code to copy property values of two objects
Last year I wrote short posting about how to use LINQ to find matching properties of two objects. In this posting I will show you how to copy values from one object to another and how to boost up performance so you can use this strategy also on in servers under heavy load.
-
Windows Azure Tools and SDK 1.1 (February 2010)
With Windows Azure official launch there is available new version of Windows Azure Tools and SDK 1.1. Also there are updated and new sample applications available in MSDN Code Library.
-
Linking jQueryUI DatePicker and FullCalendar
In one of my sample projects I wrote simple calendar solution. Users can select dates from calendar and see what events they have on selected days. I used jQueryUI DatePicker and FullCalendar components. In this posting I will show you how to link them together.
-
.NET Framework 4.0: Comparing LINQ and PLINQ performance
In one of my sessions I demonstrated how PLINQ uses two CPU-s instead of one and has better performance than non-parallel processing. In this posting I will introduce my experiment and show you my example results. In the end of this posting you can find source code that is ready for demonstration.
-
ASP.NET 4.0: How to use application warm-up class
About week ago I introduced IIS Application Warm-up Module. ASP.NET 4.0 provides separate mechanism for same purposes. ASP.NET 4.0 application warm-up is different and if you like you can use both warm-up methods together. In this posting I will show you how to make ASP.NET 4.0 application warm-up work.
-
Creating configuration reader for web and cloud environments
Currently it is not possible to make changes to web.config file that is hosted on Windows Azure. If you want to change web.config you have to deploy your application again. If you want to be able to modify configuration you must use web role settings. In this blog post I will show you how to write configuration wrapper class that detects runtime environment and reads settings based on this knowledge.
-
IIS Application Warm-Up Module
During one of my sessions I demonstrated how to use IIS Application Warm-Up Module. Some applications need to perform initialization tasks before taking requests from users. Application warm-up module is very good tool for this because it does not depend on script language or any other aspect of web application. In this posting I will show you how to use application warm-up module with simple PHP script.