are.ehibou.com

January 30, 2009

c#.NET file acces denied problem

Filed under: C#.NET, Side Notes — Tags: , — admin @ 4:03 pm

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);
  • Share/Bookmark

November 18, 2008

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]

  • Share/Bookmark

September 12, 2008

anonymous, dynamic, variable classes and methods

Filed under: Side Notes, php — Tags: — admin @ 2:53 pm

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();
  • Share/Bookmark
« Newer PostsOlder Posts »

Powered by WordPress