Saturday, January 29, 2011

"Access denied" in accessing arcgis server from remote

A couple of weeks ago we upgraded our gis server(esri) from 9.3 to 9.3.1. nothing too much exciting about that except for the following problem:

After we uninstall the ags 9.3 from the server we restart it. than, we installed 9.3.1 and all good(allegedly). than we wanted to manage the gis server from another server. when doing the configuration we got:

"Access Denied: Either the SOM service on machine is not started or the user attempting this connection is not a member of the agsuser or agsadmin group and cannot be granted access to the SOM."

Of course everything was started and we could manage the gis server from local ArcCatalog.

After hours of searching and google-ing we found that our Dcom was disabled(remember the restart? that's what probably cause the Dcom settings to change).

The fix:

On the server, go to Start > Run and type dcomcnfg
Component Services > Computers and right click on My Computer-> Choose Properties.
In the Default Properties tab => ensure that "Enable Distributed COM on the computer" is checked.

That what solved our problem, but here's a link to 1000 solutions for this same problem:

Good luck.

Friday, January 21, 2011

Silverlight control template–Part II

As I promised in my last post I will show you how to change the visual appearance of controls that are not content control.

For this explanation I will create round text box.

I will start from the end and show you the complete result:


And the style code:

<Style x:Key="TextBoxStyle" TargetType="TextBox">
          <Setter Property="Template">
                  <ControlTemplate TargetType="TextBox">
                      <Grid x:Name="RootElement">
                          <Border x:Name="Border" BorderThickness="{TemplateBinding BorderThickness}" 
                                  CornerRadius="15" BorderBrush="Black" >
                              <ScrollViewer Height="Auto" 
                                                    x:Name="ContentElement" Width="100"
                                                    Padding="{TemplateBinding Padding}" 

At first, it's look exactly the same as the example of the round button. but the big difference is in the bolded text. because text box does not have a content we cannot use content presenter to holds it's content. but every textbox has the place where you can write things, and you need some way to present it in your template!

In my case, The ScrollViewer comes to help. and why? because in the textbox defenition it defines "place holder" for the text area, in order for us to be able replace it with another control. so I defined a ScrollViewer and gave it the name of the part "ContentElement".

What? Where? How?

From msdn:

[TemplatePartAttribute(Name = "ContentElement", Type = typeof(FrameworkElement))]
[TemplateVisualStateAttribute(Name = "InvalidUnfocused", GroupName = "ValidationStates")]
[TemplateVisualStateAttribute(Name = "InvalidFocused", GroupName = "ValidationStates")]
[TemplateVisualStateAttribute(Name = "ReadOnly", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Unfocused", GroupName = "FocusStates")]
[TemplateVisualStateAttribute(Name = "Valid", GroupName = "ValidationStates")]
[TemplateVisualStateAttribute(Name = "MouseOver", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Focused", GroupName = "FocusStates")]
public class TextBox : Control

The control defines TemplatePart that can be any FrameworkElement and by defining this part it will behave as text holder for the text box. (p.s the state the you see are the visual state that you can define to the control)

Here is the same code with button as ContentElement part of the textbox:

(The text is not the content of the button! you can write whatever you like in runtime)


All silverlight controls defines parts that helps you change the control's appearance without loosing it's behivor! all you need to do is go to the control definition is msdn – and start desigining your controls!

Silverlight rocks!!