c#.NET file acces denied problem


I was trying to access a file with the user having only read permission. the code looked like:

FileStream fs =new FileStream(
"c:\path\to\file.ext",
FileMode.Open); 

and it uset to throw exception “access denied”. After some investigations I’ve found that FileAccess.Read helps a lot.

FileStream fs = new FileStream(
"c:\path\to\file.ext",
FileMode.Open,
FileAccess.Read); 

MDX complement operator problem


Playing with Microsoft SQL Server Analysis services 2005 and MDX language. Could not find many resources or error reference on the internet.

The following MDX query was created using query painter:
Select (-({[My Dimension].[My Hierarchy].[My Level].&[Not existing member]})) ON COLUMNS FROM [My Cube]
Executing this query results in an error:

Set used with the complement operator must have all members from the same level.

Workaround is to use EXCEPT function instead of "-" operator like this:
Select ({EXCEPT([My Dimension].[My Hierarchy].[My Level],[My Dimension].[My Hierarchy].[My Level].&[Not existing member])}) ON COLUMNS FROM [My Cube]

anonymous, dynamic, variable classes and methods


To call a method by dynamic name you can do this:

$methodName="MyMethod";
$result=$methodName();

To create a class by dynamic name you can do this:

$className="MyClass";
$classVar=new $className;

To call any method by dynamic name in previously initialized class you can do this:

$methodName="MyMethod";
$result=$classVar->$methodName();