.NET手记

.NET学习

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  7 随笔 :: 4 文章 :: 5 评论 :: 0 引用

2011年5月17日 #

  在SSAS中,我们通常会对cube建立分区,建立分区时,需要注意一些事项,否则在做ETL数据包来自动处理cube分区则会找不到相应的分区。

 

第一步:建立分区,点击“新建分区”,我们会看到一个弹出界面“分区向导”,在这个界面当中选择“度量值组”,查找范围是工程中定义的数据源视图,在界面下部分,会有选项事实表可以选择。在这个向导界面,不需要做太多操作,可以直接下一步。

 

第二步:接上一步,我们会看到以下界面,默认的选项“制定查询以限制行” 是没有打钩的,这个部分需要人工选择上,然后在查询框中添加WHERE条件。

这个时候就需要注意了,在查询框中,有人会自己写SELECT语句,用*代表所有字段,经过实践证明,直接写SELECT * FROM TEST 是可以添加分区成功,而且部署也是能够

成功的,但是在我们需要用ETL数据包来自动PROCESS这个cube的时候,是找不到这个分区的,原因就在SELECT * FROM语句当中,只能按照默认的表名+字段方式,才能正确部署并显示出来, 所以不建议开发人员自己手动来写此部分的字段列表,而可以按照默认的字段列表就可。

 

 

posted @ 2011-05-17 17:12 baggiojing 阅读(229) 评论(3) 编辑

2011年4月7日 #

关于在SSAS中添加角色时 需要注意将SSAS.database文件签出、签入。

当向SSAS工程文件中添加角色时,需要注意,改变的有两个文件SSAS.dwprojSSAS.database,所以当添加或者删除角色的时候,需要同时将以上两个文件签出,并且在完成添加或者删除动作后,需要将以上两个文件签入。

在添加角色时候,SSAS.database文件会添加以下节点

<Role dwd:design-time-name="9454ad3f-9a69-486d-802e-66b86333f276">

<ID>Role 7</ID>

<Name>物流</Name>

<CreatedTimestamp>0001-01-01T00:00:00Z</CreatedTimestamp>

<LastSchemaUpdate>0001-01-01T00:00:00Z</LastSchemaUpdate>

<Description></Description>

<Members>

<Member>

<Name>物流组</Name>

</Member>

</Members>

</Role>

以及:

<DatabasePermission dwd:design-time-name="efc2e653-3c30-4b44-936a-e99ed214e41b">

<ID>DatabasePermission 7</ID>

<Name>DatabasePermission 7</Name>

<CreatedTimestamp>0001-01-01T00:00:00Z</CreatedTimestamp>

<LastSchemaUpdate>0001-01-01T00:00:00Z</LastSchemaUpdate>

<RoleID>Role 7</RoleID>

<Read>Allowed</Read>

</DatabasePermission>

而在SSAS.dwproj工程文件中 会添加以下节点:

<Roles>

<ProjectItem>

<Name>型录.role</Name>

<FullPath>型录.role</FullPath>

</ProjectItem>

<Roles>

当然在SSAS中建立了角色Role之后,开发人员都会向角色添加用户或者用户组,那么在部署此SSAS工程的之前,我们需要在部署服务器上先添加用户或者用户组,这样才不会出现“出现以下系统错误: 帐户名与安全标识间无任何映射完成”

 

 

经过上面步骤之后,我们会确定这个角色拥有那么些cubedimensionmeasure的权限,这个时候如果给某一个角色添加了一个cubedimensionmeasure的权限,那么在这个cubexml当中会添加如下节点:

<CubePermissions>

<CubePermission dwd:design-time-name="fd77358a-e840-4f8a-9543-985103dac124">

<ID>CubePermission</ID>

<Name>CubePermission</Name>

<CreatedTimestamp>0001-01-01T00:00:00Z</CreatedTimestamp>

<LastSchemaUpdate>0001-01-01T00:00:00Z</LastSchemaUpdate>

<RoleID>Role 1</RoleID>

<Read>Allowed</Read>

<ReadSourceData>None</ReadSourceData>

<DimensionPermissions>

<DimensionPermission dwd:design-time-name="f7f51477-6ab6-4196-b84e-43928dc851a1">

<CubeDimensionID>Measures</CubeDimensionID>

<Read>Allowed</Read>

<AttributePermissions>

<AttributePermission dwd:design-time-name="199bbf94-1259-42bb-ad45-7d36d97fd514">

<AttributeID>Measures</AttributeID>

<DeniedSet>{[Measures].[saleprice]}</DeniedSet>

</AttributePermission>

</AttributePermissions>

</DimensionPermission>

</DimensionPermissions>

</CubePermission>

posted @ 2011-04-07 15:11 baggiojing 阅读(151) 评论(0) 编辑

2008年11月3日 #

In This Tutorial:

·         C# compiler demo for the web - type code in a web page, compile and execute it on the client

·         How to enable dynamic code compilation for a Silverlight application

·         How to execute third party DLL from within a Silverlight application

Download source code

View sample

What Is It Good For?

·         The compiled code is fast. It runs full speed on the client.

·         It enables very flexible programs easily. Here are some example uses:

o   Procedural texture generation (Perlin noise, 3-d textures, clouds, landscapes, and other). This is my next demo, btw.

o   Fractals. The ability to compile code on-the-fly is very nice for experiments with fractals

o   Advanced option that enables huge flexibility of LOB apps. Good for filtering database queries and such

o   Simple plugins to extend a program

·         As a side effect of using this technique, you’ll learn how to delay load Silverlight code – usable for making huge apps that load themselves part by part only when needed

·         It’s good for educational purposes. Inspire more people to try and start coding!

Design 

The C# compiler sample does not compile on the client machine. Instead, the C# source is sent to a web service and compiled there.

Then on the client side Silverlight loads the DLL that is returned from the web service and executes it.

Implementation

Perhaps the most interesting part of this sample is loading and assembly at runtime from within the Silverlight client application:

I’ve seen several heavy and not-so-obvious implementations on the web. It’s just a few lines of code, once you know how.

                AssemblyPart part = new AssemblyPart();

                MemoryStream stream = new MemoryStream(e.Result.AssemblyRawData);

                _compiledAssembly = part.Load(stream);

Another interesting part is the web service compilation code:

With small modification, you can change it to target VB or WPF. Look at CompileHelper.cs in the source code.

            Microsoft.CSharp.CSharpCodeProvider provider;

            CompilerParameters parameters;

            CompilerResults results;

 

            parameters = new System.CodeDom.Compiler.CompilerParameters();

            parameters.GenerateInMemory = true;

            parameters.OutputAssembly = outputAssemblyFileName;

            parameters.TreatWarningsAsErrors = false;

            parameters.WarningLevel = 4;

            parameters.TempFiles.KeepFiles = false;

            if (TargetFramework == TargetFramework.Silverlight)

            {

                // Silverlight only: ignore the rsp file, because we want to replace the

                // default desktop .net framework mscorlib and other "default" dlls

                // with the Silverlight ones

                parameters.CompilerOptions = " /nostdlib ";

            }

            parameters.ReferencedAssemblies.AddRange(referencedAssemblies);

 

            try

            {

                provider = new Microsoft.CSharp.CSharpCodeProvider();

                results = provider.CompileAssemblyFromSource(parameters, text);

 

                errors = new List<ErrorInfo>(results.Errors.Count);

                foreach (CompilerError error in results.Errors)

                {

                    ErrorInfo info = new ErrorInfo();

                    info.Column = error.Column;

                    info.ErrorNumber = error.ErrorNumber;

                    info.ErrorText = error.ErrorText;

                    info.FileName = error.FileName;

                    info.IsWarning = error.IsWarning;

                    info.Line = error.Line;

                    errors.Add(info);

                }

 

                if (results.Errors.Count == 0)

                {

                    return results.CompiledAssembly;

                }

 

                return null;

 

            }

            catch (Exception e)

            {

                Debug.WriteLine(e.Message);

                errors = new List<ErrorInfo>();

                return null;

            }

 

Here are the 7 easy steps to learn C#, in my opinion: http://www.nokola.com/trycsharp/LearnCSharp.aspx

That’s all. Hope you’ll like this sample!

Published Sunday, July 27, 2008 8:35 AM by nikola

posted @ 2008-11-03 11:14 baggiojing 阅读(944) 评论(0) 编辑

2008年10月31日 #

Themes Quick Reference

Expression Dark Thumbnail Expression Dark Expression Light Thumbnail Expression Light
Rainier Orange Thumbnail Rainier Orange Rainier Purple Thumbnail Rainier Purple
Shiny Red Thumbnail Shiny Red Shiny Blue Thumbnail Shiny Blue

ImplicitStyleManager

Encapsulates an attached behavior that propagates styles in a framework element's associated resource dictionary to its children. The class also provides attached properties that allow the resource dictionary to be loaded from an external source.
ImplicitStyleManager example

ExpressionDarkTheme

Implicitly applies the Expression dark theme to all of its descendent FrameworkElements.
ExpressionDarkTheme example

ExpressionLightTheme

Implicitly applies the Expression light theme to all of its descendent FrameworkElements.
ExpressionLightTheme example

RainierPurpleTheme

Implicitly applies the Rainier purple theme to all of its descendent FrameworkElements.
RainierPurpleTheme example

RainierOrangeTheme

Implicitly applies the Rainier orange theme to all of its descendent FrameworkElements.
RainierOrangeTheme example

ShinyBlueTheme

Implicitly applies the Shiny Blue theme to all of its descendent FrameworkElements.
ShinyBlueTheme example

ShinyRedTheme

Implicitly applies the Shiny Red theme to all of its descendent FrameworkElements.
ShinyRedTheme example


More Theming Resources

posted @ 2008-10-31 17:03 baggiojing 阅读(262) 评论(1) 编辑

BarSeries

Represents a control that contains a data series to be rendered in bar format.
BarSeries example

ColumnSeries

Represents a control that contains a data series to be rendered in column format.
ColumnSeries example

PieSeries

Represents a control that contains a data series to be rendered in pie format.
PieSeries example

LineSeries

Represents a control that contains a data series to be rendered in X/Y line format.
LineSeries example

ScatterSeries

Represents a control that contains a data series to be rendered in X/Y scatter format.
ScatterSeries example

More Charting Resources

posted @ 2008-10-31 17:02 baggiojing 阅读(285) 评论(1) 编辑

TreeView

Represents a control that displays hierarchical data in a tree structure that has items that can expand and collapse.
TreeView example

AutoCompleteBox

Represents a control that combines a text box and a drop down popup containing a selection control. AutoCompleteBox allows users to filter an items list.
AutoCompleteBox example

NumericUpDown

Represents a control that enables single value selection from a numeric range of values through a Spinner and TextBox.
NumericUpDown example

DockPanel

Defines an area where you can arrange child elements either horizontally or vertically, relative to each other.
DockPanel example

WrapPanel

Positions child elements in sequential position from left to right, breaking content to the next line at the edge of the containing box.
WrapPanel example

Viewbox

Defines a content decorator that can stretch and scale a single child to fill the available space.
Viewbox example

Label

Represents the text label for a control.
Label example

HeaderedContentControl

The base class for all controls that contain single content and have a header.
HeaderedContentControl example

Expander

Represents a control that displays a header and has a collapsible content window.
Expander example

HeaderedItemsControl

Represents a control that contains multiple items and have a header.
HeaderedItemsControl example

More resources

原文地址:http://www.codeplex.com/Silverlight/Wiki/View.aspx?title=Silverlight%20Toolkit%20Overview%20Part%201&referringTitle=Home&ANCHOR#TreeView

posted @ 2008-10-31 17:00 baggiojing 阅读(243) 评论(0) 编辑

2008年10月22日 #

Important! migrating older code to the newer release

If you are migrating Silverlight applications that were created for the Silverlight 2 Beta 2 release or earlier to the final release of Silverlight 2, you must get the newest Silverlight 2 Tools for Visual Studio 2008 and recompile your project(s).

  1. Get the newest version of Silverlight 2 Tools for Visual Studio 2008. You can get these tools from the SDK or online at Getting Started. You may have to uninstall any old tools before doing this installation.

  2. Open your old project (for example, .csproj file). A dialog box will come up notifying you that your project was created by using an older version of Silverlight tools and asks you if you want to upgrade your project. Click the Yes button.

  3. Debug. Many of the breaking changes you are likely to encounter can be found in this document.

 

ContentPresenter now derives from FrameworkElement instead of Control

Who Is Affected: Applications that use ContentPresenter or objects derived from ContentPresenter.

Summary

Because ContentPresenter now derives from FrameworkElement, the following properties are no longer exposed by ContentPresenter:

  • Background

  • BorderBrush

  • BorderThickness

  • DefaultStyleKey

  • FontFamily

  • FontSize

  • FontStretch

  • FontStyle

  • FontWeight

  • Foreground

  • HorizontalContentAlignment

  • IsEnabled

  • IsTabStop

  • Padding

  • TabIndex

  • TabNavigation

  • Template

  • VerticalContentAlignment

 

Fix Required

Remove all these obsolete properties from your ContentPresenter objects, which will likely require that you re-work some of your code to restore your previous UI rendering.

Layout rendering slightly changed

Who Is Affected: All content using layout might be rendered slightly differently because layout no longer causes elements to be rendered at subpixel locations.

Summary

The layout system in Silverlight has been modified to round final measure and arrange values to integers when positioning elements on the screen ("pixel snapping"). The result is crisper lines, more consistent rendering look, and fewer rendering artifacts.

By default, layout rounding will be on, but there is a new inherited property on UIElement called UseLayoutRounding that can be set to false if the old layout behavior is desired.

Note:

It is possible that this change will affect how your animations render, in which case you might want to set UseLayoutRounding to false.

Note:

This change does not affect transforms. If you apply a transform to an element, it may still be rendered at a subpixel location.

 

 

Cross domain hosts of Silverlight must set the right MIME type for XAP (application/x-silverlight-app)

Who Is Affected: Anyone serving Silverlight 2 applications from cross domain:

  • Via a Web server that is not IIS7

  • Via a Web server where the MIME type for .XAP files is incorrectly configured

Summary/Fix Required

When the XAP is served from a different domain than the host HTML page, Silverlight will validate that the MIME type (Content-Type response header) returned on the HTTP response is application/x-silverlight-app.

Apache (and perhaps other servers) typically serve unrecognized content as text/plain, and therefore will be affected by this change. You are required to add an entry for the Silverlight XAP MIME type to your .htaccess file. For example, AddType application/x-silverlight-app xap.

 

Note:

IIS7 included the correct MIME type configurations for Silverlight XAPs. No action is required if you are using IIS7.

Exceptions now thrown in HttpWebRequest.EndGetResponse()

Who Is Affected: Silverlight 2 applications that use HttpWebRequest.

Summary/Fix Required

For HttpWebRequest:

Before:

  • Some security exceptions (for example, cross-scheme violations) were being raised in HttpWebRequest.BeingGetResponse()

  • All other request error conditions were being returned as 404s.

Now:

  • Error conditions are now raised as exceptions in HttpRequest.EndGetResponse().

    • Request security errors (for example, requests not allowed by cross domain policy) raise SecurityExceptions

    • Non-successful requests (for example, those that returned 404 error messages) raise WebExceptions. The WebException.Response is set to HttpStatusCode.NotFound. This is compatible with the desktop.

Font URI is restricted to assembly resource

What Is Affected: Silverlight 2 Beta 1 or Beta 2 applications (not Silverlight 1.0 applications) that reference fonts (or collections of fonts) by way of the URI syntax in the Control.FontFamily, TextBlock.FontFamily or Glyphs.FontUri attributes and where the fonts are not embedded in the assembly (.dll) of the control or application.

Fix Required

You can specify a font (or in some cases a zip of fonts) in URI format through the Control.FontFamily, TextBlock.FontFamily and the Glyphs.FontUri attributes. If you are, you will have to make sure that your font is marked as a "resource" in the project system.

Browser.HtmlElementCollection replaced with by Browser.ScriptObjectCollection

What Is Affected: Silvlierlight 2 Beta 2 applications that use the HTML bridge HtmlElementCollection will break if this change is checked in. The type has been replaced with a new type: ScriptObjectCollection.

Summary

The System.Windows.Browser.HtmlElementCollection type was changed to ScriptObjectCollection. All previous references to HtmlElement on the collection have been changed to instead reference ScriptObject. Other areas of the HTML bridge that previously used HtmlElementCollection (that is HtmlElement.Children) have been switched to instead return a ScriptObjectCollection. Note that if you retrieve an item from the new ScriptObjectCollection that is actually an HtmlElement, you can still cast the return value back to an HtmlElement.

The specific benefit from this change is that across all browsers you can now access both element and non-element DOM nodes that are contained in a node collection. We made this change because there is no consistent cross-browser implementation of a HtmlElement-specific collection type.

Fix Required

Change existing references to HtmlElementCollection to ScriptObjectCollection. If your existing code was working with HtmlElement return values, you must explicitly cast the items returned from a ScriptObjectCollection to an HtmlElement. Since the collection type is now ScriptObjectCollection it is likely that on different browsers the ordinality of the resulting collection will also change. Any code that was relying on fixed offsets into the collection may have to be changed to account for non-element nodes (for example, text nodes such as whitespace, etc…) in the collection.

Beta 2

C# Code
HtmlElement myHtmlElement = someOtherHtmlElement.Children[5];

 

Release

C# Code
HtmlElement myHtmlElement = (HtmlElement)someOtherHtmlElement.Children[5]; //assuming the desired element is still at offset 5

Exceptions when changing some properties on an Active Animation

What Is Affected: Silverlight 1.0 and 2.0 applications that change properties on active animations.

Summary

When you change one of the properties in the following list on an active Storyboard, an exception is raised at runtime with this message: “Operation is not valid on an active Animation or Storyboard. Root Storyboard must be stopped first."

The list of properties that cannot be modified on an active animation or Storyboard are in the following list:

Attached Properties

  • Storyboard.TargetNameProperty

  • Storyboard.TargetPropertyProperty

Properties on derived classes from Timeline of a collection type

  • Storyboard.Children (you cannot add/remove animations from an active storyboard)

  • ColorAnimationUsingKeyFrames.KeyFrames

  • DoubleAnimationUsingKeyFrames.KeyFrames

  • PointAnimationUsingKeyFrames.KeyFrames

  • ObjectAnimationUsingKeyFrames.KeyFrames

Make sure that you stop the Storyboard before changing one of these properties. You can do this by using the Storyboard.Stop method.

System.Windows.Controls.Extended.dll renamed to System.Windows.Controls.dll

Who Is Affected: Anyone who uses the extended controls (Calendar, DatePicker, TabControl and GridSplitter).

Fix Required

Change all references from System.Controls.Extended to System.Windows.Controls and recompile your application.

VisualStateManager changes

Who Is Affected: Silverlight 2 applications that use VisualStateManager.

Summary

VisualTransition.Duration has changed to VisualTransition.GeneratedDuration. This value will now only affect the generated transitions, and not the VisualTransition.Storyboard.

Example:

In the XAML shown here, the VSM generated animations for the Pressed-> Normal transition will be created with 1 second durations. The explicit transition Storyboard with its blue ColorAnimation will still be 2 seconds.

XAML Code
<vsm:VisualStateGroup x:Name="CommonStateGroup">
                        ...
                        <vsm:VisualStateGroup.Transitions>
                        ...
                        <vsm:VisualTransition From="Pressed" To="Normal" GeneratedDuration="0:0:1">
                        <Storyboard>
                        <ColorAnimation Storyboard.TargetName="MainRect"  Duration="0:0:2"
                        Storyboard.TargetProperty="Fill" SpeedRatio="2" To="Blue"/>
                        </Storyboard>
                        </vsm:VisualTransition>
                        </vsm:VisualStateGroup.Transitions>
                        </vsm:VisualStateGroup>

VisualStateManager.CustomVisualStateManager should be set on the root visual of the ControlTemplate or UserControl, not the Control/UserControl itself. In the following example, the custom visual state manager is set on the Grid, the ControlTemplate’s root visual.

XAML Code
<ControlTemplate  TargetType="local:CheckBox">
                        <Grid x:Name="RootElement" HorizontalAlignment="Center"
                        VerticalAlignment="Center" Background="Transparent">
                        <vsm:VisualStateManager.CustomVisualStateManager>
                        <local:MyVisualStateManager>
                        </vsm:VisualStateManager.CustomVisualStateManager>
                        ...
                        </Grid>
                        </ControlTemplate>
posted @ 2008-10-22 16:02 baggiojing 阅读(339) 评论(0) 编辑