↓ Archives ↓

Between the Code Lines

Programming or Creating – Which is My Passion?

I found a very interesting question on Programmers (a Stack Exchange Q&A site):

Is programming your passion or is creating your passion?

This made me think. Here’s my answer:

For me, creating and programming/coding exchange the roles of passion and medium.

Let me elaborate that a bit. I have 2 things that get me going – an idea for a project or a puzzle.

Puzzles are pure coding challenges for me and while I usually feel intrigued by them, most of the time I get a guilty feeling of procrastination. I’m talking here about coding puzzle like Pex4Fun where the only thing you get from solving a puzzle is self-confirmation.

If I start with an idea coding is my medium to release the creative energy that has built up inside of me while playing around with the idea in my head. I’m not one of those programmers who just write code to create and say they’re done when the application has all the functionality they envisioned. No, I also want to make my code pretty, clean with lots of cleverness in it. I hate spaghetti code and I love refactoring. I also love code architecture and patterns. This is where creativity becomes a medium to my coding passion. This is also where puzzles come in. As I said, I love solving puzzles and this time I don’t feel like I’m procrastinating. When I feel happy about the code I start implementing new parts of the idea and here the roles changes again. I get the feeling of completion when I feel happy both about the product and the code behind it.

Technorati Tags: , , ,

MvcOpenID – Open Source OpenID Starter Kit for ASP.NET MVC

Last week was quite a productive one for me. Pulling in about  4 to 5 productive hours a day as you can see from the graph below. I’m happy about that.

MvcOpenID   Open Source OpenID Starter Kit for ASP.NET MVC

So what was I up to, you might ask. Well I’ll tell you. I decided to publish my first open source project. It’s an OpenID Starter Kit for ASP.NET MVC. Essentially it is an ASP.NET MVC empty project with the added functionality that handles users logging-in with their OpenIDs. I’m still at a very early stage, but the core is there. I plan to break the project into 3 parts – Basic, PopUp and AJAX. The difference is essentially in user’s experience when logging-in. Basic and PopUp have a separate page for login. After entering you OpenID the Basic method will redirect you to your OpenID provider’s page while PopUp will open a smaller PopUp window. AJAX approach will have a box popup wherever on the page you are. I’m still unsure how the user gets to OpenID provider’s page with this approach, but I’ll get to that when I get there. Each of these 3 parts will be implemented using Razor and ASPX view engines.

As I’m not a reinventing-the-wheel kind of a developer my project is using a library called DotNetOpenAuth by Andrew Arnott. It is a very extensive library for OpenID, OAuth and InfoCard for .NET and I’d be a fool not to use it. The project also uses Entity Framework 4. I’ve also added a guide how to convert the project to get the new features of Entity Framework CTP4 like code-first. But I couldn’t ship that as the CTP license does not permit it. As far as I came to understand from that lawyer talk.

And speaking of licenses, was that a pain to choose. I spent 3 or 4 days just reading articles, forums and of course licenses themselves. I really liked what Jeff Atwood wrote on the subject in his article Pick a License, Any License. Choosing a license is a very crucial step when publishing an open source project. Without it people can’t do much more then look at your code or they’ll violate your copyrights. This is where your chosen license steps in and let’s them know how they can use your code, where are the limitations when publishing their code that uses yours and if/how they need attribute you or the project. When choosing a license I found that the answers to these three questions will leave you standing with just a few choices. That’s a good thing.

After reading around I was left with Microsoft Public License (Ms-PL), Apache License, version 2.0 and a MIT-style license. I looked what similar projects use. By similar I mean written for the Microsoft’s .Net framework and preferably an ASP.NET MVC related project. It seemed that most of them used Ms-PL so I chose that one, but switched to Apache License v2.0 soon afterward just because it seems to be more widely used so more people will know what’s it about and how to use the source that’s licensed that way.

That was pretty much it for last week. If you’d like to check out the project itself there’s a few ways to do that:

  • MvcOpenID on CodePlex – this is the primary hub for the project. Any discussions and issue tracking will take place here. You can download the code or use Mercurial (Hg).
  • MvcOpenID on GitHub – this is another repository I push the code to. It’s mostly there for git users and also because the GitHub site has a lot of awesome features.
  • MvcOpenID on Ohloh – I’ve also submited MvcOpenID to Ohloh. It’s a free public directory of open source software and people.

Check the project out and I hope you like it. Any feedback I can get is of course very welcome.

Technorati Tags: , ,

Mercurial (Hg) and Git Global Ignore Files for Windows

Last update: 16/11/2010

So yet another post that is meant mainly for myself, but maybe someone else will find in it as well.

The ignore pattern I use for Visual Studio projects is the same for both Mercurial and Git:

build/
*.suo
*.user
_ReSharper*
*.csproj.user
*.resharper.user
*.suo
*.cache
*.trx
Thumbs.db
[Bb]in
[Dd]ebug
[Oo]bj
[Rr]elease
[Tt]est[Rr]esult*
_UpgradeReport_Files
*[Pp]ublish.xml
*.project
*.metadata
logs
*.generated.cs
T4MVC.cs

The only difference is how to set global ignore rules for each of them. I found these two great tutorials for this:

UPDATE (16/11/2010): After using Hg for a while with my ASP.NET MVC projects I’ve added a few things to the ignore list.

Technorati Tags: , , , ,

TortoiseSVN Global Ignore Pattern

I’m mainly posting this for myself, so I don’t lose my SVN’s ignore pattern again. So here it is:

*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store *bin *obj RECYCLER Bin *.user *.suo VSMacros80

I use it for Visual Studio for now. I will update this if I add something along the way.

Technorati Tags: , ,

Fixing Crawl Errors from Google Webmaster Tools on IIS7

Crawl Errors in Google Webmaster Tools are a way for Google to notify you (a webmaster) that while googlebot tried to crawl a URL on your site it could not access it. It also gives you a description of the error, the date the error was detected and a list of links that point to that URL.

There’s quite a few reasons an error could occur. What to do with specific error is left entirely up to you. In this article I’ll explain how to fix “Not Found” crawl errors using rewrite rules in Web.config file.

The first thing you should do is check the “Linked from” list for outside links. If someone out there is linking to your site with a wrong URL it won’t do you much good. There are two things that you could do:

  • Contact the site that’s linking to you and ask them to correct the link.
  • You can make a 301 redirect to the correct URL. This will be explained later on.

All of ‘Not Found’ URLs should return a 404 HTTP status code. You can check this with the Fetch as Googlebot tool. There are 2 options you have when dealing with these:

  • If the URL is pointing to a page that was on your site but no longer exists you should return a 410 HTTP status code. This will tell your users, Google and other search engines that your site is ‘Gone’.
  • If the URL is pointing to a page that was moved to another URL you should do a 301 redirect that points to the correct URL.

Rewrite Rules and Web.config

Rewrite rules are a set of rules that tell your web server what to do with some URLs. These rules can be quite complex. But

Technorati Tags: , , , ,