Wednesday, May 30, 2012

How did I get started on computers and programming?

In response to Scott Hanselman's post, I decided to tell my story. I would love to hear your story, too.

Pravetz 8
I first touched a computer when I was 5th grade in the elementary school. There was this class called "Computers" that everyone could see and use a computer. The computers were Pravetz 8 machines and there were very little thing you can do with them. I just tried typing on the keyboard, since there were nobody who can show us how to use the computer - I was deeply disappointed. There were also six or seven Macintosh machines that we weren't allowed to touch, because they were too expensive.

Several years after that in the secondary school, a schoolmate of mine told me that he know how to make websites. I got very excited and he land me a booк called "DHTML in action". This was one of the very few books translated in Bulgarian back then. I started reading and become really passionate about web design, html and so on. I was surprised that by typing words, I can add colors, change fonts, show images, make things move around. When I get to the JavaScript part, everything get almost magical - repeating some stuff several times, writing conditional expressions - I felt like being in Alice's Wonderland.

Unfortunately, I didn't have a computer at home. I had to go to Game clubs (they were very popular then) and pay for hour to write html pages and exercise what I read. It was pretty strange, since all the people around me were playing Counter Strike, Unreal Tournament, chatting in mIRC, etc. It was difficult to do what I wanted because, gaming clubs used to have shell around the Windows OS in order to prevent damaging the machines and this really limited my experience. I was amazed to find a website in Bulgarian for web design - Groove Manifesto and this quickly get one of my favourite resources in the net.

One night several months later, me and my brother asked for a PC as a Christmas gift from our parents. Those days a decent PC configuration costed around $700 which was a little fortune here in Bulgaria and not many people were able to afford it. Still, I did a very compelling speech in front them, about how this is going to be my profession one day and that I really need the computer to work and learn, instead of playing games and fooling around. So, this did the trick and we got our first computer.

We were really really happy boys! I remember that we had 32MB NVidia video card, which was the best you could get. Almost immediately, we got a dialup internet which was as well quite a luxury. The first thing I did after connecting, was to download a mp3 - No Leaf Clover by Metallica (yeah!). This PC is still working after several upgrades and I actively used it as a complimentary PC for various stuff until a couple of years.

I started reading and practising even more. I bought a book about C and after that another one about C++ and started writing my first programs using DevC++ compiler. I recall my hard times understanding what an object means and what the h*ll should I do with it. The rest is history - I attended some high school competitions, made my first very lame sites and decided to study informatics in the university.

So, the end of my story should be - Thanks mom and dad  for getting me my first computer and thus making me a programmer! I know that this was the most expensive present I will have (and not only for the money).

I would love to read your story, too so feel free to use the comments form or post a link to your blog post.

Tuesday, May 29, 2012

Adding microdata to your breadcrumb with Sitefinity

As you probably know, microdata is great way for improving your web appearance and adding semantic to your markup. This way, search engines and other automated web engines make greater use of your content, serve it in a better to the users and other various benefits. The microdata format is different for all the content types you can have on your site and today I will write about the breadcrumb.

The Goal

According to the specification, the mark up of your breadcrumb should look like this: 

(The itemscope="" attribute should be actually only itemscope, with no ="" in the end. Probably, blogger + my syntax highlighter script are playing tricks here. Take a look at the specification.)
When you are developing your website directly editing your markup, the task is very simple. Just add the appropriate attributes and their values in your php/html/ or whatever code you use and that's it. When using CMS, you usually will have to tweak something in your setup, most probably there is a template that is used for displaying your breadcrumb. This is what I'm going to show you in Sitefinity.

The Breadcrumb widget in Sitefinity

Unfortunately, you cannot edit this widget through the widget templates page in the administration nor from the Thunder extension (at least, I don't see them for some reason). So what I did is to drag the Breadcrumb widget on a page -> click Edit and you will see the following screen:

You have two choices here: either edit the existing Breadcrumb template, which means that every where on your site the markup will be changed or create new template and apply it on the appropriate places. I took the second approach in order to rollback and test easier possible issues. So, I copied the code from the existing template and created a new one called "Breadcrumb with microdata". Internally the breadcrumb widget uses RadSiteMap control (from Telerik's suite) and you need to change the default template rendered to the following:
<%@ Control Language="C#" %>
<%@ Register Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
<div class="sfBreadcrumbWrp">
<sf:sitefinitylabel cssclass="sfBreadcrumbLabel" hideifnotext="true" id="BreadcrumbLabel" runat="server" wrappertagname="span">
    <telerik:radsitemap id="Breadcrumb" runat="server" skin="Sitefinity">
        <defaultlevelsettings layout="Flow" listlayout-repeatdirection="Horizontal">
            <div itemscope="" itemtype="">
<a href=" Page.ResolveUrl((string)DataBinder.Eval(Container.DataItem," url="url">" itemprop="url"&gt;
                  <span itemprop="title">&lt;%# DataBinder.Eval(Container.DataItem, "title") %&gt;</span>
Mind the 'itemscope', 'itemtype' and 'itemprop' attributes I added. These are the microdata formats that you need for a breadcrumb. Another thing that worth mentioning is that the Url of the data item that is binded is relative url and you need to resolve it using Page.ResolveUrl to an absolute one. Apart from that, things are pretty straightforward. You click the "Save changes" button and from here your changes are already applied to the template. If the template is used somewhere already - the changes are live so you would prefer to try this not on your live environment first.

The final result

Probably, you noticed that in the li element there is a div with class="rsmTemplate" and another div in it with the microdata format. This is because I couldn't find a way to edit the template of the wrapping div. Otherwise, It would be much better to have only one div element. The itemscope="" attribute is a little messed here, because of the highlight script I use, it's actually only itemscope as in the specification above.

When you are ready, you can use the google webmaster rich snippets tool to check whether your markup is correctly decorated with the microdata format. This tool will show your markup, as seen by the google engine and will show you if you have missed something in your html code.

That's all for now. I hope you find this helpful.

Monday, May 14, 2012

Choosing the cloud for your database

Some time ago, I was asked to give a lecture about Relational databases in cloud environment as part of Telerik Academy. While strengthening my knowledge and skills in this area, I made a research on the current solutions offered and asked myself "Which one is better?"... And then this post was born :).

Have in mind that this is a guide that researches only the database cloud options, ignoring where your corresponding application is hosted. I will try to extract some advices that will not be vendor (or technology) specific, since this is rapidly changing environment. Even while I was writing this post and preparing for my session, Amazon announced their support for SQL Server database. This is a big news according to my opinion, as Amazon are starting direct competition with Microsoft and their SQL Azure offering, trying to beat them in their own field. If they are going to succeed - depends on what is your project.

In order to choose which cloud solution is the one for your project, you first need to know what are your project requirements, priorities and roadmap. There are several areas where Amazon and Microsoft widely defer giving you different advantages and disadvantages to choose from. 
  • Budget
  • High availability
  • High scalability
  • Ease of use
  • Database features
  • Performance
Before choosing your cloud vendor, your first need to figure out how every single one of this aspects corresponds to your project and prioritize them. Give them priorities from 1 to 5 and avoid giving equal priorities. Every choice that you make from this list is a trade of that you make and often you want be able to satisfy two or more aspects equally. 


Budget is usually the strongest limitation for every project. A deep research in the pricing model of every cloud vendor is required in order to make a good decision here. In my opinion, SQL Azure offering is easier to understand and predict, even though it might be not so flexible with respect to the actual resources used. Have in mind, that the final cost for your cloud account might be function of different parameters like - disk storage used, inbound and outbound data traffic, CPU utilization, etc. Amazon's RDS for example, have a more sophisticated tariff plan and that's why might be difficult to estimate what will be your monthly expenses. A good understanding of the provided service is also a must when choosing your cloud solution. In SQL Azure, the "high availability" feature comes out of the box at no cost, while in Amazon RDS this might double or triple your monthly expenses.

High availability

Speaking of high availability, be sure to read all the agreements that are part of your contract. Amazon RDS will reserve their right for up to 4 hours a week downtime for maintenance and upgrade procedures. This might be a deal breaker for your project or might force you to subscribe for higher cost plans (in particular case the Mutli AZ plans will provide you with failover instance when maintenance occurs to your active one). 


Having a good perspective about the future of your project and more specific your database needs, you might require a cloud solution that scales well. Most of the projects I've worked so far, have constantly increasing database size and this is usually a key business requirement that cannot be overlooked. For most businesses, gathering more data means offering a better product or service. Lately, serving personalized content according to customers needs and flavours means a better user experience and all this means - gathering data, loads of data. 

Microsoft Azure and Amazon RDS have different scaling options. While Amazon RDS have really good scale up possibilities, they are still limited by the hardware used and the cost for maintenance. Scaling up on the other hand comes at zero development and administrative effort and is a good solution for smaller projects and not very big requirements. SQL Azure real strength is in scaling out. Using federations, you can really go beyond the limits of the hardware nowadays and lower your cost for high class hardware and infrastructure maintenance. This on the other hand will cost you some effort in development and might be not applicable in some cases.Without knowing your business plan and future roadmap of your project, you won't be able to get the best option here.

Ease of use

Sometimes, the fast development and initial deployment of your project is crucial for succeeding. You all know about those time sensitive tasks that aim to get the maximum of a specific hype and sometimes just a few days or a week delay everything pointless. That's why the better tooling environment might be the key feature that will give you the answer. If you are used to mysql tooling environment, starting a new project on SQL Azure might not be the best call for you. On the other hand Microsoft have developed a whole cloud based development platform for interacting with your database instances. This way, all you need is your azure subscription and you get all the services needed - that database itself and all the database client tools that you need to finish your project.

Database features

According to Amazon RDS, the database instances that they provide are pretty much the same as you know them outside the cloud. On the other hand, SQL Azure is written from scratch for the cloud and currently lacks some of the features you know from SQL Server - CLR, Service Broker, Analysis services, Replication etc. This might make the transition of your existing application to the cloud a little bit harder, but will bring some really cloudy features to your toolbox.


Last, but certainly not least - the performance. It is scientifically proved that the performance of  your web application is tight correlated with the bounce rate and exit rate in your analytic report. Again, knowing your customers and the business requirements will give you the answer how important is the performance for your application. Comparing the performance between different cloud vendors is difficult again. It depends on your location when running the test and your connectivity with the vendors' data centres. It also depends on what hardware you have subscribed for and your specific database implementation. You might get better result for one specific database schema on SQL Azure and totally different results when using other database for the tests. I guess that the best approach here is to make performance tests against your real project. Have in mind that usually better performance means higher costs and this directly contradicts with the first considerations that we have. Usually, this ends up to be a simple business decision - money vs. performance.


What all this means for you is that you as technical person probably won't be able to make this technical decision on your own. You will need to collaborate with all the stakeholders and business owners of your project in order to pick the right solution for you. No matter what solution you choose, have in mind that this game constantly changes the rules - new vendors enter the market, existing vendors change the offerings and this will happen even faster in the future as the cloud solutions get more and more popular and attractive. Be prepared and design your application to be flexible with respect to the cloud solution, as you might need to change it in the future.