Parsing XML Files using LINQ to XML

LINQ (Language Integrated Query) is a .NET technology that allows you to query data on different sources such as in-memory data objects, SQL Server, and XML using either query expressions or lambda expression extension methods. In this post, we will be looking more at how to use LINQ on parsing XML files using query expressions.

Now, query expressions are easier to write since it has a resemblance to and uses similar keywords to that being used in constructing SQL statements. The basic rule to remember in constructing a query expression is that it always begins with a from and ends with either a select or group by. That's a bit weird if you're used to the SQL's SELECT syntax because in SQL, you always begin with SELECT and not with a FROM but you'll get used to the syntax once you use it on a daily basis...

Creating an HTML Helper using Razor Syntax

On my previous post, I have mentioned about what I called a Razor helper and gave a glimpse of how to create one for your web application. Now, let's talk more about that in depth.

So as not to rehash what I've said in my previous post, we are going to inspect this Razor helper in both C# and VB.NET...

Integrating reCaptcha on Your Website for Spam Prevention

Whenever you have a form that is exposed to the public, that page will always be prone to spam. The most common target of spam is a comment form. Some would like to spam to someone else's site to promote their own site for the sake of search engine optimization. I'll talk about search engine optimization as a future topic but for now, let's talk about how to deal with all these spam.

The most obvious way is, of course, to use a captcha, which (by definition taken from google's recaptcha) is a program that can tell whether its user is human or computer by using colorful images with distorted text. For our discussion, let's utilize google's reCaptcha, which looks like the following...

Client-Side Binding 101 Using KnockoutJS

KnockoutJS is a Javascript framework that allows you to create a web site using MVVM design pattern. The fundamental concept of KnockoutJS is data binding so in this blog post, I'll be talking about how to bind your html elements to the data that needs to be displayed as well as to the commands associated to the events in your form.

I'll be using the Contact page of my site to explain the bindings. First off, let's create the contact form...

Site Updates: August 5, 2012

For this week, I made some major changes on my site which includes the following:

  • The blog posts are no longer static content. An xml file has been used to load the content of each blog post. I choose an xml file as my data source because it's free, unlike using a database.
  • Drill down page for a blog post has been added. One can go to the drill down page by clicking on the title of the blog post. (I know that the title does not appear to be a link going to the drill down page but I don't know how to make this appear like one without adding an underline. Any suggestions?)
  • On the drill down page, visitors of the site can post their comments. The comment utilizes the gravatar associated to one's email. If the email has no gravatar associated, a default image would be used. (In case you don't know what's a gravatar, just click on this link.)
  • New validation logic has been added to the contact page. Previously, the only validation are the required fields. Max length and email format has been added as validation rules for the appropriate fields.
  • The date created of the blog post is displayed below the title...