Jose R. Guay Paz

Most of the time on
ASP.NET, C# & SQL Server
SQL Server 2008 Liberado!!!

El día de hoy fue liberado la versión final (RTM) del tan esperado SQL Server 2008.

La noticia completa la pueden encontrar aquí (en inglés).

Todos los suscriptores de MSDN y TechNet pueden descargarlo inmediatamente.

Estas son las ediciones disponibles de SQL Server 2008 son:

SQL Server 2008 Enterprise. Con soporte de escalabilidad de clase enterprise, data-warehousing, seguridad, análisis avanzado y reportería.  

SQL Server 2008 Standard. Para aplicaciones departamentales. 

SQL Server 2008 Workgroup. Para aplicaciones branch. 

SQL Server 2008 Web. Para aplicaciones web. Diseñada para ser de bajo costo, tener alta disponibilidad y a gran escala. 

SQL Server 2008 Developer. Similar a la versión Enterprise, pero se licencia únicamente para efectos de desarrollo de aplicaciones y es por cada desarrollador. 

SQL Server 2008 Express. GRATUITA. Para aplicaciones de escritorio y efectos de aprendizaje. 

SQL Server Compact 3.5. GRATUITA. Para aplicaciones móviles. 

Disfrútenlo!!

 

Book Review: ASP.NET Ajax In Action

Hi all.

I've been reading this book for a few weeks now and thought of writting a few lines about it.

About the Book

Well, to start just to point out that the book is from Manning Publications (very good book publishing company) and it's not that big (576 pages). Also, it has been aroud for almost a year know, so it's not that new, but yet, a world class bestseller.

I didn't know what to expect from this book since it was the first I got for Ajax, however I thought it might be a good book since Scott Guthrie has it on his Blog and recommends it (well, he wrote some forewords), and also there are some other excellent reviewers/reviews about it, but ok, seriously, the books is actually one of the best books I've read. It's clear, concise, right to the point, the samples actually work (not like some other books I've read) and are so simple to modify and adapt to my projects.

It really helped me get some true insights for working with Ajax. Thanks to it I've written my first javascripts to call some methods and webservices using http. And has given me a clear idea of how to work with JSON.

Anyway, if you get serious about Ajax, get this book, period.

See you on the next post.

 

Book Review: NHibernate In Action

 

Hi all.

A few weeks ago got the opportunity to read this book from Manning Publications. It's still with status of Early Access so I got an e-book.

I was very enthusiastic about it. I've had some very good comments about NHibernate so I decided to give it a try.

About the book

ORMs are not new to me, but NHibernate has some distinctive approach of doing things. I'm not an expert in the product so my comments regarding the content are quite small. The samples are easy to read and understand; it's not quantum theory but are very well thought for the sake of emphasize specific things. I had a hard time trying to follow the samples in the first and second chapter but as I got involved with the syntax and the functions everything became clear at some point.

I'm not sure if I could recommend this book for an absolute beginner but for someone with basic knowlege fo ORMs and web programming techniques it should be ok.

The one thing I didn't like was the figures, so I paid little attention to them. Hopefully by the time it hits the streets they got them better.

OK. I think that's it. The conclusion is, it's a good book and you'll catch up with some very interesting things regarding NHibernate.

Hope some of you could comment on this.

Cheers,

Videos de Silverlight 2.0

Hola fanáticos de Silverlight

Mike Taulty ha lanzado una impresionante colección de 44 screencasts sobre Silverlight 2.0. Cubre temas como el funcionamiento general de Silverlight, controles, manejo de archivos, redes, diseño de interfaces, acceso a datos, interacción con páginas de HTML y mucho mas.

Este es un valiosísimo recurso que pueden aprovechar para aprender (o actualizar sus conocimientos de)  Silverlight 2.0.

Acá está la lista de videos:

  1. Silverlight - Anatomy of an Application
  2. Silverlight - The VS Environment
  3. Silverlight - Content Controls
  4. Silverlight - Built-In Controls
  5. Silverlight - Width, Height, Margins, Padding, Alignment
  6. Silverlight - Using a GridSplitter
  7. Silverlight - Grid Layout
  8. Silverlight - StackPanel Layout
  9. Silverlight - Canvas Layout
  10. Silverlight - Databinding UI to .NET Classes
  11. Silverlight - Simple Styles
  12. Silverlight - Custom Types in XAML
  13. Silverlight - Binding with Conversion
  14. Silverlight - List Based Data Binding
  15. Silverlight - Simple User Control
  16. Silverlight - Templating a Button
  17. Silverlight - Resources from XAP/DLL/Site Of Origin
  18. Silverlight - Animations & Storyboards
  19. Silverlight - Uploads with WebClient
  20. Silverlight - Downloads with WebClient
  21. Silverlight - Calling HTTPS Web Services
  22. Silverlight - Calling Web Services
  23. Silverlight - Making Cross Domain Requests
  24. Silverlight - Using HttpWebRequest
  25. Silverlight - File Dialogs and User Files
  26. Silverlight - Using Sockets
  27. Silverlight - Using Isolated Storage
  28. Silverlight - .NET Code Modifying HTML
  29. Silverlight - Using Isolated Storage Quotas
  30. Silverlight - Calling JavaScript from .NET
  31. Silverlight - Evaluating JavaScript from .NET Code
  32. Silverlight - Handling HTML Events in .NET Code
  33. Silverlight - Handling .NET Events in JavaScript
  34. Silverlight - Calling .NET from JavaScript
  35. Silverlight - Displaying a Custom Splash Screen
  36. Silverlight - Passing Parameters from your Web Page
  37. Silverlight - Loading Media at Runtime
  38. Silverlight - Dynamically Loading Assemblies/Code
  39. Silverlight - Reading/Writing XML
  40. Silverlight - Multiple Threads with BackgroundWorker
  41. Silverlight - Insert/Update/Delete with the DataGrid
  42. Silverlight - Getting Started with the DataGrid
  43. Silverlight - Embedding Custom Fonts

Que los disfruten!!

Official Note: Version 1.0 RTM of the SQL Server 2005 Driver for PHP is live!

It's official. You can now download version 1.0 RTM of the SQL Server 2005 Driver for PHP from the MSDN download site

The SQL Server 2005 Driver for PHP download is available to all SQL Server users at no additional charge.

The SQL Server 2005 Driver for PHP is a PHP 5 extension that allows for the reading and writing of SQL Server data from within PHP scripts. The extension provides a procedural interface for accessing data in all editions of SQL Server 2005.

Enjoy!

Noticia Oficial: La Versión 1.0 RTM Del Driver de SQL Server 2005 Para PHP Ha Sido Liberada

La versión 1.0 del Driver de SQL Server 2005 para PHP está disponible en el sitio de descargas de MSDN.

Ahora si, no hay excusas. Esta, es una extensión de PHP 5 que permite la lectura y escritura de datos almacenados en SQL Server 2005 desde scripts de PHP. La extensión provee de una interface procedural para el acceso a datos de cualquier edición de SQL Server 2005.

Saludos.

Having RadioButtons on a Repeater or DataList

Repeaters are very powerful controls that allows us to present formated information from a datasource.

Recently I needed to include some RadioButtons inside a Repeater so I could select one of the items from the repeater, but to my surprise, and old bug resurfaced. Reference to the bug can be found here but I will include some information regarding it:

SYMPTOMS

When you add a ASP.NET RadioButton control to the ItemTemplate of a data-bound Repeater server control, the RadioButton control that you created is not mutually exclusive when you run the ASP.NET page. This problem occurs even if the GroupName attribute is set for the RadioButton controls.

CAUSE

This problem occurs because the Repeater server control implements the INamingContainer interface, which requires that all controls that are nested within it must have a unique name when rendered in Hypertext Markup Language (HTML). Therefore, the HTML name attribute of any rendered child server control is unique.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Well, the products in cuestion are:

  • Microsoft ASP.NET 1.0
  • Microsoft ASP.NET 1.1

But guess what, it happens also in ASP.NET 2.0/3.0/3.5, so someone forgot to fix this thing.

Anyway, I found this very helpful article from Erick Smith at CodeGuru.com that helps overcome this problem. The solution is a JavaScript function that will be attached to every RadioButton as it is being bounded in the Repeater. The function is:

function SetUniqueRadioButton(nameregex, current)
{
      re =
new RegExp(nameregex);
     
for(i = 0; i < document.forms[0].elements.length; i++)
      
{
            elm = document.forms[0].elements[i]
            
if (elm.type == 'radio')
            {
                 
if (re.test(elm.name))
                  {
                          elm.checked =
false;
                  }
             }
      }
      current.checked =
true;
}

That you must add to your page on the HEAD section. Then link the function to the RadioButtons in the OnItemDataBound event for the Repeater. NOTE that you must know the Repeater name and the GroupName for the RadioButtons. For this example, the name of the Repeater is "Repeater1" and the name of the RadioButtons GroupName property is "RadioGroup".

And that's it. You will end up with a bunch of RadioButtons all with the same GroupName and working as expected.

protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
     
if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) return;
     
RadioButton rb = (RadioButton) e.Item.FindControl("RadioButton");
      string script = "SetUniqueRadioButton('Repeater1.*RadioGroup',this)";
      rb.Attributes.Add(
"onclick", script);
}

But you know what, this can also be applied for DataList controls. In the source code that I've included I have a page with a Repeater and a DataList so you can see that it's exactly the same form of solution.

Hope you like it. Enjoy!

 

Ensure Proper Closure & Disposal Of A DataReader

Most of the time, we create programs that use DataReaders (weather they are on ASP.NET or Winforms). They're fast, easy to use but sometimes, they fill out our connections pool and withour proper care, they can cause problems to our users.

There are some blog posts around this issue and many questions in the forums, so I'll try to make it as simple as possible so you'll find it attractive to use, because in the end, there is no magic here, just a nice tip.

The solution: Use the DataReader within the scope of a using clause. How? Take a look at this sample:

Regular Programming
In general, programmers tend to use DataReaders like this:

SqlConnection connection = new SqlConnection("connection string");
SqlCommand cmd = new SqlCommand("SELECT * FROM SomeTable", connection);
SqlDataReader reader = cmd.ExecuteReader();
if (reader != null)
{
      while (reader.Read())
      {
             
//do something
      
}
}
reader.Close();
reader.Dispose();

While this would work and do excatly what you need it to do, it does not ensure that the reader will be actualy closed and disposed. Why? it's by design. DataReaders will be kept open until they got all the data from the source and even then, they depend on the command object that should be opened with the CommandBehavior.CloseConnection parameter.

So, anyway. Here is my proposed solution to overcome this problems.

using (SqlDataReader reader = cmd.ExecuteReader())
{
       if (reader != null)
       {
              while (reader.Read())
              {
                        //do something
              }
              reader.Close();
              reader.Dispose();
       }
}

Why this works better? Because the DataReader lives only within the scope of the using clause. Once the flow leaves the using clause the datareader is forced to deallocate from memory thus closing/disposing it properly.

Hope this will help you get the most of DataReaders because, yes, they are the FASTEST way to get data from any datasource.

Enjoy!!

 

Ya Disponible: Preview 1 de ASP.NET AJAX 4.0

Ya es oficial!!

El Primer Preview de ASP.NET Ajax 4.0 acaba de salir a la luz. Pueden ver el Roadmap para mas información sobre el contenido de este preview y si pueden, por favor envíen un poco de feedback.

Este preview contiene (entre otros) las siguientes implementaciones:

  • Client-side template rendering
  • Declarative instantiation of behaviors and controls
  • DataView control
  • Markup extensions
  • Bindings

La página de descarga de CodePlex está aquí.

Saludos!!

Now Available at CodePlex: ASP.NET AJAX 4.0 Preview 1

Well, it's official. The first preview for the new Ajax features in ASP.NET just went live. Check out the Roadmap for information about what it covers and if you can, provide some feedback.

This preview contains preview implementations for the following features:

  • Client-side template rendering
  • Declarative instantiation of behaviors and controls
  • DataView control
  • Markup extensions
  • Bindings

You can find the download page at CodePlex here.

Enjoy!!

 

More Posts Next page »