Thursday, May 24, 2012

using variables in css - CSS Pre-Processors

Have you ever felt that CSS should be more powerful, having variables, expressions, code reuse capability between classes and other such stuff. If yes then here is an option to do all that. I stumbled to it a few days back and found it to be quite impressive.
Less - The dynamic stylesheet language, lets you to specify widely used values in a single place, and then re-use them throughout the style sheet.

Below is a simple example of LESS code:

// LESS
@color: #4D926F;
#header
{
     color: @color;
}
h2
{
     color: @color;
}
/* Compiled CSS */
#header
{
      color: #4D926F;
}
h2
{
     color: #4D926F;
}

 LESS offers a lot more than this. To know more check their website...

Edit 28th Oct, 2012:

I just found that Less is not alone and its one of the members of family called CSS Pre-processors. I also read a very nice blog post from Miller H. Borges Medeiros illustrating some drawbacks of using these.

Tuesday, May 1, 2012

Report Server Model generation error: Table has a non-primary data source

A lil bit unorthodox solution!!

I faced this error (Report Server Model generation error: Table has a non-primary data source) yesterday while working on SSRS. I was trying to create a Report Model (SMDL) on SQL Server Buisness Development Studio and was getting this error repeatedly in final step of “Report Model Wizard”.

Query which I was using in Data Source View was somewhat like below:

SELECT Table1.Col1, Table1.Col2, Table2.Col2, Table2.Col3
FROM Table1
JOIN Table2
ON Table1.Col1 = Table2.col1

I googled this error a bit but found no solution and hence I adopted this lil bit unorthodox option.

My solution was to add an artificial column to my resultset and then using it as logical primary key. So I changed my query as below:

SELECT Table1.Col1, Table1.Col2, Table2.Col2, Table2.Col3 ', NEWID()AS Id
FROM Table1
JOIN Table2
ON Table1.Col1 = Table2.col1

And then I used this new column as logical primary key, as shown in below image. 



This is working like charm for me but I am yet to test this fully so use this solution for you after through testing. Hope this helps.

About Me

My photo
Delhi, India
Fun, music, travel and nature loving, always smiling, computer addict!!