More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  skuz3 spaceProfileFriendsBlog Tools Explore the Spaces community

skuz3 space

A few words about me, programming and other unimportant things
May 14

Consolas Font for Visual Studio 2005/2008

A nice link appeared in our local (czech) .NET Newsletter this week. If you are a VS 05/08 user, you have the opportunity to download and use a special highly-legible fixed-width font called "Consolas". As I've already mentioned, the font is licenced only for VS 05/08 owners.

The link is here

Consolas Font for Visual Studio 2005/2008

In my opinion, the font is not so bad, but in fact, nothing "extra"  smile_regular. On the other hand, the default font - Courier - is becoming a bit boring, isn't it?

May 08

I've installed Vista SP1

Since its release date I was waiting for SP1 to install through Windows Update. Nothing happened smile_sad ... Therefore I decided to download and install it myself.

So yesterday at 11 p.m. I downloaded the 800MB installation file and ran it on my notebook. In fact it must have been a nice night-shift for the computer. The installation took about 2 hours of intensive computer load (and for me 2 hours of intensive waiting). So I hope the improvements were really important and the installation was worth taking the trouble to do.

May 01

Frequency of my surname in Czech Republic :)

This post can be interesting mainly for Czech readers, so sorry for the English language smile_teeth

The Czech Home Office ("ministerstvo vnitra" in Czech) publishes statistics of name/surname frequencies in Czech Republic on the web (Name and surname frequencies (in Czech)). You can find, for example, that there are 165 other men in our republic with the same surname as I have smile_wink ...

Such a small number seems a bit surprising to me, regarding the population of 10 million people in the Czech Republic smile_omg

April 30

Article on 4GuysFromRolla.com - Working with XML Data Using LINQ, a TreeView, and a ListView :: Editing Data

The second part of my article concerning working with hierarchical XML data usin LINQ, TreeView and ListView has been published on the 4GuysFromRolla site. Here is the introduction:

ASP.NET includes a variety of tools for displaying and editing XML documents. A previous article, Working with XML Data Using LINQ, a TreeView, and a ListView :: Displaying Data, showed how with a TreeView control, a ListView control, an XmlDataSource control, a LinqDataSource control, and about 50 lines of code we could create a web page that displayed the contents of a hierarchical XML file. Specifically, the page displayed the contents from a fictional employee phonebook, which allowed for an arbitrary number of employees nested within branches and departments. The TreeView and XmlDataSource controls displayed the various branches and departments, while the ListView and LinqDataSource controls displayed the employees belonging to the selected branch or department (or one of its subdepartments).

In addition to displaying data, the ListView and LinqDataSource controls can be augmented to edit, insert, and delete data. This article examines how to update the ListView and code to enable the visitor to add, edit, and delete employee phone records. By the conclusion of this article we will have constructed a web page that displays XML data and enables an end user to modify the data from a simple, easy-to-use web page interface

If you want to learn more, read the whole article:

Working with XML Data Using LINQ, a TreeView, and a ListView :: Editing Data

April 28

Performing Time-Consuming operations on ASP.NET pages through WCF services

Imagine this scenario: You have an ASP.NET page containing a certain part, which isn't so important but takes much time to render. It can be for example a gravatar in the discussion, some real-time calculated statistics or an advertisment.

If you render it within normal postback - that means with the whole page, your unimportant part makes your page to load much longer.

One way to avoid this is to use WCF services and AJAX. The output that goes to the client doesn't contain your time-consuming part, but contains a javascript that can load this part from a web service that you put somewhere on your server. The main advantage is that while the WCF service works, your client is reading the page and the whole process becomes much faster.

You just need to create a WCF service, make it AJAX-enabled (i.e. choose the right project template or add a few specific attributes to your class and methods - google "Ajax enabled WCF service" for more information) and publish it on a web server.

On your page you just have to add a ScriptManager like this:

   1: <asp:ScriptManager ID="ScriptManager1" runat="server">
   2:   <Services>
   3:     <asp:ServiceReference Path="myService.svc" />
   4:   </Services>
   5: </asp:ScriptManager>

The JavaScript for asynchronous AJAX calls should contain at least two functions. One function to call the service and one to process the result:

   1: function CallService()
   2: {           
   3:   var myDiv = document.getElementById("myDiv1");  
   4:   ServiceNamespace.Service1.Method1("parameter", ServiceComplete, null, null);
   5: }
   6:  
   7: function ServiceComplete(result, userContext)
   8: {
   9:   var resultDiv = document.getElementById("resultDiv1");
  10:   resultDiv.innerHTML = userContext + " : <b>" + result + "</b>";
  11: }

As you can guess, the first method calls the WCF service, while the ServiceComplete function handles the successful result. You can also handle the event when the service fails (the last two "null" parameters on the line 4)

The service needs to contain just the appropriate class and method, with the specific attributes to enable client-script calls (ScriptService, WebSerice, WebServiceBinding and WebMethod), if you use VS.NET, it creates all this necessities for you.

View more entries
 

Mirek

View spaceSend a message
Occupation:
Age:
Location:
Interests:
I'm an IT student from Czech Republic. I study at Brno University of Technology. At work I specialize on .NET technologies (ASP.NET, WPF, WCF ...)
There are no categories in use.