DCSIMG
November 2007 - Posts - YsA.Net

November 2007 - Posts

Last Sunday, my team organized a lecture day for the .Net development teams in our company. It was great. We presented 3 topics :

  1. Monitoring memory in .Net applications - By Roy Dallal (I hope I got the name right :) )
  2. Introduction to WPF - By Doron Yaacoby
  3. Introduction to Guidance Automation - by your truly

In my lecture I presented the GAX/GAT framework (by Microsoft Patterns and Practices).

So as promised, I attached the presentation and the demo I did in the lecture : adding WCF contract attributes to an entity class and creating a singleton from template.

In order to run the demo you need :

  1. Install GAX
  2. Install GAT
  3. Install the Software Factories Toolkit
  4. I recommend to install the t4 editor - so you can see the templates more clearly.

Also, the demo contains a document which explains how to run the examples.

Have fun

Last week I posted the CSS Challenge. I got some great responses, but unfortunately they were a little problematic. I'll explain :

  1. The first solution by Ohad, was this page. The problem with this solution was the "bottom" div. It created the bottom margin for the red panel. But suppose the red panel is a container which contains a grid and a scrolling div. The grid needs to be contained inside the panel. But because the size of the red panel contains the size of the margin, the bottom of the div with the grid will be hidden by the "bottom" panel.
  2. The second solution by Alex, was this page. It worked like a charm. But it doesn't apply to IE6 browsers - it simply doesn't work on them.

So, I'm refining the definitions of the challenge :

  • You need to create this design using CSS classes only.
  • Each panel can be a div or asp.net panel control.
  • The panel should adjust automatically when the window resizes - the white panel should always cover the browser content.
  • You can not use CSS expressions or JavaScript.
  • No scroll bars are shown.
  • The margins between the panels will always be 10 pixels.
  • Each div is suppose to be a container for items. That means that if I add a div inside one of the panels and set it to 100% height and width, it will occupy the entire panel, with nothing to hide parts of it.
  • The solution must work on IE6,IE7,firefox.

I dare you to try...

with 2 comment(s)
תגים:

This is a challenge for all you web designers and CSS experts/ hackers.

Check out this design :

image

Each panel has a margin between the parent of 10 pixels in each side. The red panels are also spaced by 10 pixels with each other.

And now for the challenge :

  • You need to create this design using CSS classes only.
  • Each panel can be a div or asp.net panel control.
  • The panel should adjust automatically when the window resizes - the white panel should always cover the browser content.
  • You can not use CSS expressions or JavaScript.
  • No scroll bars are shown.
  • The margins between the panels will always be 10 pixels.

I tried to implement this design, but didn't succeeded to to so by using CSS only.

Take your shoot!

with 5 comment(s)
תגים:,

There are two ways to create a view :

  1. Through ArcSDE command line commands.
  2. A toolbox tool in ArcCatalog. In order to use it, open the toolbox in ArcCatalog -> Data Management -> Layers and Table views -> Make Table View, and follow the wizard (for more information, check out the ArcGIS 9.2 Desktop Help).

In order to create the view, you need to use the command sdetable :

sdetable -o create_view -T <view name> -t <table list separated by comma> -c <column names from the tables separated by comma> -w <where condition> -u <user name / schema name> -p <password>

For example :

We have a layer named street_lights_g which has a foreign key to a table called streets. We need a view to contain the name of the street for each street light (so it can be displayed when you perform identification. In order to create the view we will run this command :

sdetable -o create_view -T street_lights_v -t street_lights_g,streets -c street_lights_g.shape,street_lights_g.objectid,streets.name -w "street_lights_g.street_code = streets.code" -u myusername -p ...

After running the command the view will be seen in the desktop tools like a regular layer. You can add it like a regular layer to a mxd, perform queries etc...

I recommend, to check out the spatial index of the view, to see if it exists (right click on the view in ArcCatalog -> properties -> indexes). If all the grid values are 0 then you need to recalculate the index - using the recalculate button, or enter the grid values manually with the Edit button.

Troubleshooting :

Problem :

When running the command the following error message is received :

Error : DBMS view exists (-238). Error : Unable to create view <view name>

Cause :

The schema in which you tried to create the view, already contains a view with the same name.

Solution :

Delete the view from the schema using ArcCatalog. Why ? When a geographic view is created it will be registered in the sde.layers table. If the existing view is a geographic view, and you delete it from the database via console, the table will still stay registered, and you will not be able to recreate the view.

Problem :

When running the command the following error message is received :

Error: Table not registered (-220). Error: Unable to fetch registration for table <view name>.

Cause :

Geographic view was deleted from db console, and is still registered in the sde.layers table.

Solution :

  • Create a view with the same name via DB console (pl/SQL developer, SQL server management console).
  • Delete the view with ArcCatalog.
  • Rerun the command.
with 3 comment(s)
תגים:

A couple of days ago, I had to deal with a bug in a page I wrote. The page contains a couple of UpdatePanel controls. For some reason, when an exception was thrown during the PostBack of one of this panels, the page was not redirected to our error page (which is the case for all none AJAX postbacks), but it's message is displayed in an alert popup. This is not very good - it a security hole that can expose internal information (The bug was detected when my team leader, Doron, got a message which contains a SQL statement which failed to run). Further more, if an exception is not redirected to the error page it was not handled - our error page contains the logging of the unhandled exceptions.

So I started to dig in.

I found out that unhandled exceptions in the AJAX.Net framework are handled by an event in the ScriptManager : "AsyncPostBackError". You can register to this event, handle the exception (log ,etc...), and override the error message which will be displayed (If this wasn't done already by EntLib) by setting the property "AsyncPostBackErrorMessage" to the message that you want to display.

In our case, because we are using a Master page for the pages in our site, I registered to the event in the Master page, handled it with EntLib, and replaced the message (in case the EntLib configuration haven't done that already) :

protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e) { ExceptionUtils.Handle(e.Exception); ScriptManager1.AsyncPostBackErrorMessage = "exception handled"; }

In this way, I didn't had to replicate the handling code in all of our AJAX pages.

Use it wisely.

with no comments
תגים: