Sunday, March 30, 2014

Excellent idea ... Milk Machine!

While Biking somewhere in Bayern i came across this "Milk Machine". I think this is an excellent by the farmers to sell fresh milk to their customers.

 

Friday, March 28, 2014

Spring has begun this year earlier than usual..

 
 
So i had to go out see the blossoming cherry blossoms and butter flies.
 
 
 
But the occasional frost during the nights has left ist marks on flowers too:
 
 



Thursday, August 15, 2013

Taller than even me!

Although I am not used of seeing People taller than me but this couple managed it  with the help of some wooden legs...
 

Saturday, September 08, 2012

SSAS : Save hours by automating the cube deployments!


Every now and then it is quite an overhead in large development environments to deploy the SSAS cubes at a large scale. Automating this process particularly helps when doing lots of changes in the SSDT (SQL Server data tools) in the development environment and when finished the changes then deploying the cubes in the UAT environment. Then after completion of next round of issues the cubes have to be deployed on the production server. With dozens of cubes, with each of it requiring deployment to two additional environments it is a considerable overhead to do it manually.

I have recently automated the deployment of a few dozen of cubes. There are several ways to do it, the below one is among the simpler ones. Basically it is about creating deployment profiles in SSDT and then invoking the SSDT via command line to build the cubes and use a SSAS utility (Microsoft.AnalysisServices.Deployment.exe )  to deploy the cubes.

The Microsoft.AnalysisServices.Deployment.exe utility can be found in this path:

Drive:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio

For creating the deployment profiles in SSDT, right click on the top line in the solution explorer, i.e. the solution and then Properties. Then click the “configuration manager” and then under ‘Active Solution configuration’ in the drop down, click “New” and give the configuration profile a name, e.g. SSASProject_Production. Now for the newly created profile, edit the deployment location in the properties page. It will change the deployment address only for that particular profile.

The data source connection properties have to be edited in the SSDT project file (found with the extension .dwproj , can be opened in notepad), it can be found inside the SSDT project folder. This file has a format like this and the location of the profile with data source connection can be found near to these kind tags around end of the file.

  <Name>SSAS Prod</Name>
      <Options>
        <ConnectionMappings>
          <ConfigurationSetting>

………   
All steps can be combined in a batch file.
----------------Batch file start ------------------------------------------------
 
ECHO ON
ECHO Build started . . .

REM  here is the location of your visual studio/SSDT exe, in this case its C, the project solution file location, the deployment profile name “SSAS Prod” here and the location of the build log file, it can be anywhere.

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" "C:\***\****\***\***\******\SSAS_Project.sln" /build "SSAS Prod" /out "C:\ ***\****\***\***\******\\ssasbuild.log"

 ECHO Build completed . . .

 ECHO XMLA Script generation started 

REM now invoking the deployment utility. The first argument is location of the SSAS database file, can be fund inside bin folder of SSDT project with extension .asdat and the location of .xmla file which is to be generated here for deployment.

Microsoft.AnalysisServices.Deployment.exe "C:\ **\****\***\***\******\SSAS_Project.asdatabase" /d /o:"C:\ ***\****\***\***\******\SSAS_Deployment.xmla"


ECHO XMLA Script generation complete . . .

ECHO Deployment is starting now.......

REM Finally deploy the solution.

Microsoft.AnalysisServices.Deployment.exe "C:\ ***\****\***\***\******\SSAS_Project.asdatabase" /s:"C:\ ***\****\***\***\******\SSAS_Proejct\deployment.log"


 ECHO OFF

PAUSE Completed

----------------Batch file End ------------------------------------------------

 

1)      Create configuration profiles for each deployment environments

2)      Update the batch file with locations of each project or make one file for all of the projects/cube.

3)      See log for any deployment issues!

4)      process your cubes via SSIS or another method!

You are done!

Thursday, February 10, 2011

Junk Dimensions?!


Quite often SSAS/DWH designers face with the situation with several if not dozens of small what could be called small dimensions, e.g. Yes/No flags, status etc. To make each of them a separate dimension (say 20 different Yes/No flags dimensions) would simply clutter the data mart and eventually the SSAS cube. The convenient way in my opinion is to rather combine all of them in one dimension with all possible combinations (Cartesian product) from of them from Fact table in the combined dimensions.

So it could look like this:  

DimFlags(FlagID,Status1Flag, Status2Flag, Status3Flag, … etc)
 
 
 
 

Wednesday, September 03, 2008

Minimum sliding Window Problem can be solved in O(n) rather easily.

Several solutions to the minumum sliding window Problem actually create complexity  but in my opinion it can solved with rather ease while still maintaining the time and Memory complexity at O(n).

The idea is to basically create a temporary sum and Keep adding the new elements and subtracting the old elements as we scan the Array while keeping record of the last biggest sum window by storing its index.

So we need to scan the Array only once and without any additional array.


# include <iostream>
using namespace::std;

const int datalentgh=16;
int data[datalentgh]= {2, 3, 10, 12, 6, 2, 5, 1,9,8,1,5,3,8,9,9};

void main()
{
for(int i=0;i<datalentgh;i++)
cout<<data[i]<<" ";
// we create the variables for temporary sum, temporary starting index and for final starting index of the window and its sum.
int sum, tsum,start,tstart, k;
sum=tsum=start=tstart=0;
k=3;
for(int i=0; i < k ; i++)
sum+=data[i];
tsum=sum;
for(int i=k; i < datalentgh ; i++)
{
tsum= tsum - data[i-k];
tsum= tsum + data[i];
tstart=i-k;
if(tsum>sum)
{
sum=tsum;
start=tstart;
}



}

cout<<endl<<endl<<" Starting Index of Minimum Window is "<<start+1<<" and the number at that index is "<<data[start+1] <<" and sum is "<<sum<<endl;

system("pause");
}