Monday, July 30, 2012

The making of Warcraft part 1 (link)

Back before the dawn of time, which is to say when PC games were written for the DOS operating system, I got to work on a game called Warcraft.

Read more...

Three Rules for Database Work (link)

Some developers love working with relational databases, and other developers can't stand to touch them. Either way - if your application uses a database, you have to treat the database with some respect. The database is as much a part of an application as the code and the models inside the software.

Here are three rules I've learned to live by over the years of working with relational databases.

Read here more...

Monday, July 23, 2012

The Entity Framework source code is today being released under an open source license (Apache 2.0)

Scott Guthrie (form Microsoft) wrote this in his blog:

The Entity Framework source code is today being released under an open source license (Apache 2.0), and the code repository is now hosted on CodePlex (using Git) to further increase development transparency. This will enable everyone in the community to be able to engage and provide feedback on code checkins, bug fixes, new feature development and build and test the product on a daily basis using the most up to date version of the source code and tests. Community contributions will also be welcomed, so you can help shape and build Entity Framework into an even better product. You can find all the details on the Entity Framework CodePlex Site.

Friday, July 20, 2012

Git, SSH, PuTTY, GitHub, Unfuddle, the kitchen sink (link)

After reading a good number of the guides for getting Git/ GitHub/ Unfuddle working correctly in Windows, I finally got it sorted out. I had to use a bunch of things I had not used before so I realized it's probably a good idea to share my findings, hoping to help someone else (and maybe myself again) in the future. Read more...

Tuesday, July 17, 2012

Get Your Database Under Version Control (link)

Here is old but good intro into Database Under Version Control

How to consume YouTube video feed from C#

Before starting you should register developer key: https://code.google.com/apis/youtube/dashboard

Here is link to documentation: https://developers.google.com/youtube/2.0/developers_guide_protocol_audience

We will start by installing Google.GData.YouTube NuGet package:

PM> Install-Package Google.GData.YouTube
**Note** If you using MonoDevelop IDE, sorry but first you will have to download .NET library for the Google Data API manually from here

Let's create new console application project. In our example will fetch title and id of all uploaded videos of TobyGames user. Pay attention that we will use StartIndex and NumberToRetrieve on query object for result pagination. And here follows the source code of our example:

using System;
using Google.YouTube;
using Google.GData.Client;
using Google.GData.YouTube;

namespace YouTubeApiSample
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            var settings = new YouTubeRequestSettings ("API_YouTube", "YOUR_API_KEY_HERE");
            
            int index = 1;
            int pageSize = 9;

            while (true) {

                var request = new YouTubeRequest (settings);
                var query = new YouTubeQuery("http://gdata.youtube.com/feeds/api/users/windowsazure/uploads");
                
                query.OrderBy = "published";
                query.StartIndex = index;
                query.NumberToRetrieve = pageSize;

                Feed<Video> feed = null;

                try
                {
                    feed = request.Get<Video>(query);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error have occurred while retrieving data from YouTube: {0}", ex.Message);
                }
                
                if (feed != null && feed.Entries != null) {

                    int count = 0;
                    try
                    {
                        foreach (var entry in feed.Entries) {
                            Console.WriteLine("Video title: {0} -> Id: {1}", entry.Title, entry.Id);
                            count++;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error have occurred while retrieving data from YouTube: {0}", ex.Message);
                        break;
                    }

                    if (count < pageSize) {
                        Console.WriteLine("All data fetched!");
                        break;
                    }

                    index = index + count + 1;
                }
                else {
                    Console.WriteLine("Error have occurred while retrieving data from YouTube.");
                    break;
                }
            }
        }
    }
}

Thursday, July 12, 2012

Wednesday, July 4, 2012

Github syntax highlighting style for VisualStudio

I created Github inspired syntax highlighting theme for VisualStudio. This theme is very light on colors. Here follows screenshot of github theme in action:

As always you can find it on github.com

Tuesday, July 3, 2012

Guidelines and rules for GetHashCode by Eric Lippert

This is best post about GetHashCode guidelines in C# world.