Guillermo G. Blog

Software Architect
ASP.NET MCP
"The best way to predict the future is to invent it"
Tool: A Free Online JavaScript Compression Tool

I was testing a web page using Microsoft Visual Studio 2008 Test Suite, when I saw the final report, it shows me that this page have big size (aprox. 800 Kb); wow it's a big web page, but it's a page that don't contains large images or other graphical elements, but have a lot of JavaScript code included.

Searching for a tool to minimize those javascript files, I found this site Bananascript.com, that's a free online tool to compress javascript files into very small and self extracting files.

I uploaded the biggest JavaScript file that was 600 Kb aprox, and clicked the compress button, the result .... a new compressed file of 300 Kb aprox, working without problems in my web project.

Then if you need to minimize a JavaScript file you can use this free tool, thanks to "wildcard_swe" for this work!.

Enjoy It!

Posted: Mar 04 2009, 06:15 PM by gugonzar | with 4 comment(s)
Filed under: , ,
Info: Running WcfTestClient Tool in a PC without VS.Net 2008

WcfTestClient

Microsoft Visual Studio .Net 2008 comes with a tool to test our WCF services called WcfTestClient, you can run it from "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe". But what happens if you need to run this tool to test a WCF Service in a PC that don't have Microsoft Visual Studio .Net 2008 installed?

Well, you simply need to copy the listed files from the next path "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\":

  • SvcUtil.exe
  • SvcUtil.exe.config
  • WcfSvcHost.chm*
  • WcfSvcHost.exe
  • WcfSvcHost.exe.config
  • WcfTestClient.chm*
  • WcfTestClient.exe
  • WcfTestClient.exe.config

*Files marked with an asterisk are optional.

But if you run the app shows you the next error:

Assembly Microsoft.VisualStudio.VirtualTreeGrid, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f7f11d50a3a was not found. Reinstall the assembly or Visual Studio. The application cannot continue and will exit.

And now you need to add to the previous files the next file that resides in the GAC:

  • Microsoft.VisualStudio.VirtualTreeGrid.dll

Maybe you're thinking right now ... hmm? How I can get a file from the GAC? ... It's easy!

Press the Windows Key + R, and then the Run Window appears, just copy the next path:

%windir%\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\

... and you will find a folder with the VirtualTreeGrid assembly inside. Copy this file to the same folder where the other files resides and you are ready to use WcfTestClient from a PC that don't have Microsoft Visual Studio 2008 Installed.

UPDATED April 27, 2009:
You can download all the files here.

Enyoy It!

Tip: System.Data.Entity and ClickOnce Deployment Issue

I was developing a Windows forms application in .net framework 3.5, and I needed to include ClickOnce Deployment in my solution project. Recently I downloaded and installed the last Service Pack (SP1) for Microsoft Visual Studio 2008 and .net framework 3.5, so far, everything was normal. The only application setup prerequisite was .net framework 3.5.

I published my application in a web server normally, and when I click the Install button to start the install process, I received the next error message from the ClickOnce Installer:

ClickOnce Message

The funny thing is that I didn't have any reference to System.Data.Entity in my solution, so? what's wrong? Why was ClickOnce requesting this assembly?

Well, after a quick search in Google, I found and read this Post from Mat Steeples, and I understood why ClickOnce was referencing System.Data.Entity assembly, simple!, I included a new feature (Create a Desktop Icon) and that functionality requires the mentioned assembly.

Thanks to Mat Steeples for sharing it.

Article: Some Tips for Managing and Motivating Developers...

An interesting article wrote by Esther Schindler with some tips for Developer Management and Motivation.

Managing and Motivating Developers: Tips for Management Cluefulness
Encouraging productivity from your programming staff--at least in the developers' estimation--requires a few special techniques.

Enjoy it!

Articulo: Web Application Projects vs Web Site Projects

Hace algunos días (bueno un par de meses ya), un compañero de trabajo me pregunto sobre las consideraciones que debería tener, al momento de crear un nuevo proyecto de tipo Web, como saben desde la versión 2.0 del .net Framework (y Visual Studio .Net 2005) es posible crear un nuevo tipo de proyectos denominados Web Projects que a diferencia de su antecesor, tiene una serie de características que se deben considerar al momento de su elección.

Expongo algunos ítems sobre ambos tipos de proyecto; consideremos la sigla WSP para Web Site Projects y WAP para Web Application Projects:

  • Los WSP a diferencia de los WAP no poseen archivo de proyecto, se basan en el sistema de archivos.
  • Los WSP trabajan bajo un nuevo modelo de compilación diferente al utilizado por los WAP.
  • Ambos tipos de proyecto soportan su implementación sobre  IIS o el servidor Web incorporado denominado ASP.NET Development Server.
  • Ahhh y par de consideraciones cuando se tiene VSTS.

Como ya hay bastante sobre el tema me puse en la tarea de investigar y reunir algunos enlaces donde mencionan sus principales diferencias y cuando es mejor usar uno u otro, yo soy mas dado a utilizar Web Application Projects, cuando necesito incorporar proyectos Web a mis soluciones.

Referencias utilizadas:

Quote of the day...

(English Version)
Software and cathedrals are very similar. First we built it, then we pray.
- Anonymous

(Spanish Version)
El software y las catedrales se parecen mucho. Primero lo construimos, después rezamos.
- Anónimo.

(vía Microsiervos)

Tip: ¿Cómo depurar Windows Services?

Muy seguramente si has construido una aplicación de tipo Windows Service (Servicio de Windows), has tenido que hacerte la siguiente pregunta... ¿Bueno y como hago para depurarlo?, resulta que la depuración de un Windows Service no es tan "trivial" como la de otras aplicaciones de la plataforma .net, y hay que hacer uno que otro truquito para poder hacer un seguimiento paso a paso por el código del servicio.

Rodrigo Corral nos comparte un par de trucos útiles para realizar la depuración de una aplicación de tipo Windows Service.

Muchas gracias a Rodrigo por compartir este par de tips.

AJAX: How to create a "Processing" modal window using UpdateProgress and ModalPopup ASP.net AJAX controls

ajax

Originally posted as "AJAX: Como crear una ventana ..." in Spanish on December 13th 2007.

A few days ago I had need to implement some functionality based on AJAX technology in a Web application that I was developing. When a request is sent to the server doing click to some web control in the page, AJAX "hide" the Postback to our eyes and sometimes is so difficult to detect, that the page is processing the request based on the click event.

There is an AJAX ASP.net Control that provides status information about partial-page updates called UpdateProgress. It's very useful to "control" the user patience but permits that the user continue interacting with other controls in the application, and rare behaviors can result if the user clicks other button or does other Postback action.

// UpdateProgress Implementation Example 
<asp:UpdateProgress ID="UpdateProg1" DisplayAfter="0" runat="server"> 
  <ProgressTemplate> 
    <div style="position: relative; top: 30%; text-align: center;">  
     <img src="loading.gif" style="vertical-align:middle" alt="Processing"/> 
      Processing ... 
    </div> 
  </ProgressTemplate> 
</asp:UpdateProgress> 

Unfortunately doesn't exists an ASP.net AJAX control that "blocks" the application while a Postback request is made to the server, but fortunately we can make a powerful combination using this control in conjunction with an AJAX Control Toolkit's called ModalPopup Extender, that allows a page to display content to the user in a "modal" manner which prevents the user from interacting with the rest of the page.

//Modal Popup Extender Implementation Example 
<ajaxToolkit:ModalPopupExtender ID="ModalProgress" 
runat="server" TargetControlID="panelUpdateProgress"  
BackgroundCssClass="modalBackground" PopupControlID="panelUpdateProgress" /> 

Now, this is the interesting part, take the power of each one of this controls to create a composite functionality that shows a progress indicator to the user in a modal window way, blocking the user interaction with the application while it's processing a previous Postback request. The next code example shows how to do this:

// Include this page directives to reference ASP.net AJAX controls
// from AJAX and the Toolkit 
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" 
TagPrefix="asp" %> 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" 
TagPrefix="ajaxToolkit" %>
 
// Include ScriptManager tag manages client script for Microsoft  
// ASP.NET AJAX pages 
<asp:ScriptManager ID="ScriptManager1" runat="server" /> 
 
// Include UpdateProgress Control inside a Panel Control  
// and then the ModalPopupExtender Control 
<asp:Panel ID="panelUpdateProgress" runat="server" 
CssClass="updateProgress"> 
    <asp:UpdateProgress ID="UpdateProg1" DisplayAfter="0" runat="server"> 
      <ProgressTemplate> 
        <div style="position: relative; top: 30%; text-align: center;"> 
          <img src="loading.gif" style="vertical-align: middle" 
          alt="Processing" /> 
          Processing ... 
        </div> 
      </ProgressTemplate> 
    </asp:UpdateProgress> 
  </asp:Panel> 
<ajaxToolkit:ModalPopupExtender ID="ModalProgress" runat="server" 
TargetControlID="panelUpdateProgress" BackgroundCssClass="modalBackground" 
PopupControlID="panelUpdateProgress" />

It's necessary to add a pair of javasctript functions that are executed at the initial and final AJAX requests.

//JavaScript code included at jsUpdateProgress.js file
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq); 
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq);    
function beginReq(sender, args){ 
    // shows the Popup 
    $find(ModalProgress).show();        
} 
 
function endReq(sender, args) { 
    //  shows the Popup 
    $find(ModalProgress).hide(); 
} 

You can view that the javascript functions references a variable called ModalProgress, this variable must be created in the ASP.net page's code. The next code shows how to do it:

<script type="text/javascript" language="javascript"> 
      var ModalProgress ='<%= ModalProgress.ClientID %>';         
</script> 
 
<script type="text/javascript" src="jsUpdateProgress.js"></script>

Finally we add a little CSS code to show a gray contour in the modal window, and a cute format to the image and text.

.modalBackground 
{ 
    background-color: Gray; 
    filter: alpha(opacity=50); 
    opacity: 0.50; 
} 
 
.updateProgress 
{ 
    border-width: 1px; 
    border-style: solid; 
    background-color: #FFFFFF; 
    position: absolute; 
    width: 180px; 
    height: 65px; 
} 
 

You can download the source code from the above code examples, and include an Update Progress Modal Window in your Web applications.

Tool: RegularExpression FSA Visualizer

Thanks to my friend Gabriel Porras for sharing me this excellent tool intended to demonstrate the implementation of regular expressions AKA regex. It's a graphical tool that shows how regular expressions engines use FSA (Finite State Automata) to match regex patterns against text.

This fabulous tool is called Reanimator was built by Oliver Steele. Thanks to Oliver for share this tool with us.

How many regex has built today?

Image: The only valid measurement of code quality


A funny image that shows a "cruel reality" of software development, and a curious form for calculate code quality.

This image was taken from Rodrigo Corral Blog and the original post it's called "Métrica de calidad de código".

How many WTFs / min have their revisions of quality control?

More Posts Next page »