
Back to Blog index.
As the year is soon drawing to and end, it is time to wish everybody a happy new year 2009! As in the previous years, the URL of this blog is going to change, so please update your URLs. The current URL is often the following:
http://www.saunalahti.fi/janij/blog/2008.xml
Now, you need to change the year number to 2009 like this:
http://www.saunalahti.fi/janij/blog/2009.xml
Thanks for reading this blog!
Microsoft has just recently released the "RTM" version of their Application Architecture Guide 2.0 book on CodePlex.
The book talks about correctly designing and implementing applications on the .NET platform, and is available as a 3 MB electronic book with 380 pages. Worth your time, I'm sure!
Microsoft has just recently release a new tool called the "Microsoft Code Analysis Tool .NET" (CAT.NET) which helps common variants of common web application vulnerabilities. The tool does this by scanning your application, and installs as a Visual Studio snap-in (plugin). Here's information about the tool:
"The engine works by reading the target assembly and all reference assemblies used in the application -- module-by-module -- and then analyzing all of the methods contained within each. It finally displays the issues its finds in a list that you can use to jump directly to the places in your application's source code where those issues were found."
To donwload the CTP version of the tool visit Microsoft Downloads.
It's Christmas time again, so it's time to wish everyone Merry Christmas!
I recently installed a Windows Server 2008 Standard box for testing, and everything ran succesfully during install. I entered a product key from MSDN, but didn't bother to activate just yet.
After running the system succesfully for several days, I though it would be a good time to activate. But strangely enough, I got an activation error with data "Code: 0x8007232B, Description: DNS name does not exists."
Ahem, what did I do wrong? Installation media from MSDN, code from MSDN. Did I foget something? No, I double-checked the key, the media, and both were correct/valid. What to do, since activation still didn't work. Solution: change the product key, but change it back to what is was before! To do so, I opened the properties window of Computer (right-click in Start menu; this is the same as going to Control Panel and opening the System applet or by pressing Win+Break), and then clicked the Change Product Key link, re-entered the original key, and activated. Problem solved: all was okay this time!
By the way, to run the Windows Activation quickly, simply run "SLUI.EXE" from the System32 directory. And to change the product key, go to Computer Properties.
I needed to do some development work on Microsoft Exchange 2003 server (reading e-mails and so on), and noticed that it would be great if I could quickly start and stop the services from the command-line. As I previously wrote about starting and stopping SQL Server services, I thought I'd use the same technique when working with Exchange.
The only trouble was getting the service names. Luckily, a command 'sc query | find "SERVICE_NAME"' revealed the service names, except one. The list of services you need are:
SERVICE_NAME: MSExchangeIS SERVICE_NAME: MSExchangeMGMT SERVICE_NAME: MSExchangeSA SERVICE_NAME: RESvc
By using the "sc" command you can easily start and stop these services. Once you know their names, that is!
I had the chance to write a short Finnish article about ASP.NET MVC to CodeZone Finland. The article is titled "ASP.NET MVC -sovellusten rakenne tutuksi" and is available as a PDF file here.
Enjoy!
Hello readers, another year has soon passed by, and this means that the URL of this blog will change. Today, you are reading this with an URL like "http://www.saunalahti.fi/janij/blog/2008.xml", and as you can see from the URL, I keep a single year's worth of posts in each XML file.
Thus, next year, the blog URL will be "http://www.saunalahti.fi/janij/blog/2009.xml". Of course, this new URL won't work just yet, but will soon.
Thanks for reading!
eWeek has a nice hands-on article about using the trendy jQuery JavaScript library in Visual Studio 2008. The article is titled "Developing with jQuery in Microsoft Visual Studio 2008".
If you are interested in jQuery and want to use it with Visual Studio, check this article out. The official place to learn more about jQuery is jquery.com.
Developer.com has just published my two-part articles related to ASP.NET MVC development. The article #1 is simply titled "ASP.NET MVC 101" and is available here.
The second part is titled "Accepting Input and Manipulating Data in ASP.NET MVC" and available here.
Enjoy!
Just a quick link share for today. If you are interested in learning more about developing applications for Windows Azure, be sure to check out the Microsoft Azure Services Training Kit - PDC Preview. This kit is available from Microsoft Downloads.
This kit is about 45 MB in size and requires Windows Server 2008 or Windows Vista with SP1 to install. Thus, it won't install on Windows XP, for instance.
Sometimes when working with XML documents and/or web applications, you need to know whether a XML, HTML, ASPX or a text file is Unicode encoded. This is very easy of course if you have a text editor, Visual Studio or a development tool available, but sometimes you don't. How then could you detect file's Unicode encoding and the presence of a byte order mark (BOM) without any tools except those that Windows has to offer?
Luckily, there are at least two options: one is to use Notepad, and the second is to use the "type" command in the command shell (cmd.exe or "DOS prompt"). Here's how to do it.
First, Notepad. To detect the Unicode encoding, open the file with Notepad. Then, choose File/Save As, and the Save As dialog box opens. This dialog box has a field called Encoding. This field will by default have the value that corresponds to the encoding that the file currently has. It is for example UTF-8, or ANSI if there's no Unicode BOM in the file.
The second option is to use the command-line command "type" which is available the Windows Command Prompt. Then, simply type the file in question to the console. Since type doesn't understand about Unicode BOMs, then if the file's two or three first characters are garbage (sort of), then you know that the file is in fact Unicode encoded. Unicode BOMs are discussed for example at www.unicode.org.
You could call this the "Unicode tip of the week".
Are you already using .NET 3.5 SP1? If yes, then you can utilize a very nice technique for "webifying" databases, called ASP.NET Dynamic Data. If you are not yet familiar with this new technology, MSDN has an introduction for you.
If you start your first Dynamic Data project in Visual Studio 2008, and immediately run the generated application, you will unfortunately see an error message. This is because you haven't yet specified the data source you want. If you are using SQL Server, LINQ To SQL is my choice, and so you need to edit the Global.asax.cs file and follow the instructions in the code comments.
But once you are done specifying your data context, how do you continue from there? For example, you might want to specify which tables are visible, and which aren't. Easy. Just create a class named the same as the generated class name for your database table (for example, "Order"), and then associate the attribute ScaffoldTable with it:
using System.ComponentModel.DataAnnotations;
...
[ScaffoldTable(true)]
public partial class Order { }
Here, the ScaffoldTable attribute (from the System.ComponentModel.DataAnnotations namespace) indicated to the Dynamic Data system that the table should be visible. Note that since your class is a partial class, it actually doesn't make much difference where you put the declaration. For instance, a code file like "TableContol.cs" would be a good idea.
You can also control things at the column level, which is often just what you need. However specifying column-based settings is somewhat more tricky because you cannot define "partial properties" in C#, at least just yet. Thus, the option is to create a so-called metadata class for your table class, and associate these two together with the MetadataType attribute like this:
[MetadataType(typeof(MyOrderMetadata))]
public partial class Order { }
public class MyOrderMetadata
{
[ScaffoldColumn(false)]
public object OrderDate;
}
With this metadata class in place, it is easy to start defining even more attributes to the columns. Such attributes include ScaffoldColumn, DisplayFormat and UIHint.
For example:
[DisplayFormat(DataFormatString="{0:dd.MM.yyyy}")]
public object OrderDate;
Good luck with ASP.NET Dynamic Data.
› Blog Archive