Friday, July 13, 2007

Helpful tools n°2

Yesterday night I was looking for some news from an open source project, accidentally I found 2 interesting tools, one from Microsoft and one from Businessware Architects.

The one from Microsoft is the XSDObjectGen, a tool for gerating code, pure classes, from xsd Schemas. It's free to download at: http://www.microsoft.com/downloads/details.aspx?familyid=89e6b1e5-f66c-4a4d-933b-46222bb01eb0&displaylang=en

The one from Businessware Architects is the CodeXS, a code generation tool who does the same as XSDObjectGen and XSD tools from Microsoft. The Only difference is that CodeXS is open source and more, efficient, modular... It's frre to download (registration required) at: http://www.bware.biz/default.htm?http://www.bware.biz/DotNet/Development/CodeXS/Article/Article_web.htm. There's also an interesting article related to the tool which take a tour over functionality and more.

So I wish to take a try to evaluate the potential from that tool. Maybe one could say I found nothing new to the folks, but before yesterday I never saw that tools, so I want to examinee how can I use them in my projects.

Ciao!

Technorati tags: ,

Thursday, July 12, 2007

Helpful tools n°1

Yesterday's evening I was navigating and writing some code, line after line, I took a tour on the SharpDevelop Web Site, I love that tool, in the past years frequently I took a tour in the source code, to learn, to see what has been done.

So I went to the SharpDevelop Wiki and I found a wonderful online tool, a Code Converter. The tool is exposed as Web service and makes use of NRefactory to convert code.

The link is http://codeconverter.sharpdevelop.net/Default.aspx here you can find:

  1. a class converter:
    http://codeconverter.sharpdevelop.net/Convert.aspx
    the supported convertsions are:
    1. C# to VB.NET
    2. C# to Boo
    3. VB.NET to C#
    4. VB.NET to Boo
  2. a snippet converter:
    http://codeconverter.sharpdevelop.net/SnippetConverter.aspx
    the supported convertions are C# to VB.NET and vice versa.
  3. a code formatter:
    http://codeconverter.sharpdevelop.net/FormatCode.aspx
    supports ASP/XHTML, BAT, Boo, Coco, C++.NET, C#, HTML, Java, JavaScript, Patch, PHP, TeX, VBNET, XML

It's possible too to use these features in client applications directly using and calling the web service.

As example I tried to format and colorize an xml chunk as:

<configuration target="StandardDatabaseConfig">
<provider name="testProvider" refTo="XmlProvider, TestLib.Providers" />
</configuration>

the result is:


1:  <configuration target="StandardDatabaseConfig">
2:     <provider name="testProvider" refTo="XmlProvider, TestLib.Pr
oviders" />
3:  </configuration>


Fantastic tool!



Ciao!



Technorati tags: ,

AJAX and Server.Transfer battles 2° round

Yesterday, as I said in the previous post, I was fighting with some interesting features of ASP.NET Ajax 1.0. My situation was:

I had two ASP.NET pages, Page1 and Page2 configured as follow:

  •  Page1 acts as the Web Site home page
  •  Page2, in a different dircetory, acts as a chid, content page

Page1, redirects, via Server.Transfer, to child pages as Page2. Page2 contains an UpdatePanel and some DropDownLists controls.

Here is the problem, when Page2 take control, the "ajaxed" controls works fine the first time, but next time it doesn't. The exception throwed was:

Sys.WebForms.PageRequestManagerErrorException: unknown error ocurred while processing the request on the server. The status code returned from the server was: 404

So after hours spent looking for a solution, an example, or anything else could help me, I found this post http://forums.asp.net/p/1078772/1788445.aspx, the situation explained is the same as above.

The problem I experienced was that Page2 after load, mantains the correct form action, but after the first call then, the action became incorrect and no actions could be performed. So I tried to find a solution in many ways:

  1. searching if the client-page-content remains the same between the first well-done call and the second one
  2. because the ajaxed dropdown was outside the UpdatePanel, I tried to modify the related UpdatePanel Trigger

After I tried many solutions, I found very helpful the solution provied in the post. The solution is to add a Client-Side Javascript script to attach a custom function to the PageRequestManager to handle the EndRequest. There change the form action so the action remains the same across any ajax content refresh and any postback.

this is the code:

<script type="text/javascript">
<!--//
function EndRequestHandler()
{
theForm.action =
"../Folder1/Page2.aspx";
theForm._initialAction = theForm.action;
}
if( typeof(Sys) != "undefined" )
{
EndRequestHandler();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}
//-->
</script> 

Because I spent so much time over this, I think this could be helpful and useful to others, without spending time to looking for a solution!

Ciao!

Technorati tags: ,

Tuesday, July 10, 2007

AJAX and Server.Transfer battles

Today I was fighting with something special from the Ajax world. I found too much problems trying using ASP.NET AJAX in a Server.Transfer context..and after 5 hours I found a solution, the incredible thing was the solution was under my eyes and i didn't saw before now.

Tomorrow I will post the code I found and the explanation of the contextual problem.

Ciao!