De regreso - y con ASP.NET Hands On Lab

ASP.NET, CSharp, Cidesoft, JavaScript, Web 1 Comment »

Hola! bueno, no he -ni hemos- desaparecido estos meses :) . El trajin de las actividades académicas y otras extras han hecho que estemos en una pequeña pausa dentro de nuestro sitio web.

Por ende considero que lo mejor es hacer un post con contenido a todo dar y sin mucho floro ^^". A inicios de este año estuve trabajando en material didáctico sobre ASP.NET, la plataforma Microsoft para desarrollo web. Ad portas de Visual Studio 2010 es bueno estar al tanto de esta y más tecnologías que tenemos para realizar nuestros proyectos de software (por cierto, pueden probar la beta 2 de esta nueva versión, está buenísima). Este contenido es aplicable a lo que se viene el próximo año y en un principio trata temas básicos como creación de formularios, uso de controles, llegando a tocar temas como enlace a datos, AJAX y desarrollo web para dispositivos móviles.

Espero que este material sea de mucha utilidad para poder aprender sobre la tecnología, ver el potencial que tiene y para los proyectos que quieran emprender a futuro.

1. Introducción

2. Interfaces de Usuario

3. Acceso a Datos

4. AJAX

6. Desarrollo web para dispositivos móviles

*. Recursos del HOLs

P.D: Estoy dejando la 5ta parte para un post usando Visual Studio 2010 (el tema… sorpresa ^^”)

Post.End();

REMIX 2009 Belgium - See the light

ASP.NET, CSharp, Development, Silverlight, Web No Comments »

by Paul Lorena

Last 29 October, a Microsoft presentation in Brussels, the goal it’s show the Microsoft’s vision of the web in the next future. Obviously was strongly oriented to Silverligth, SketchFlow, MVC, RIA and obviously the demo on live of Surface.  They talked also about NUI (Natural User Interface)

I was really excited to attend the Brad Abrams presentation, I really enjoyed the book (co-authored by him) Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries (2nd Edition) I think it’s a “must” for every .NET software engineer , I think it’s the first time I’d listened the “ecosystem concept” in the IT domain, the concept stands the environment to use an API in a right way.

The presentation was about RIA, you can follow the Abrams’s MVC project in this link

http://blogs.msdn.com/BradA/

One day before to REMIX he talked at VISUG (I didn’t attend the session) but here the link

http://www.microsoft.com/belux/msdn/nl/chopsticks/default.aspx?id=1443# 

Some pics here

Finally! I was really surprise, to discover a lot of (really a lot of) young people not more than 20 years old, that makes me think about the new generation of developers ;) good for them! good for us…

Manipulación de imágenes en Silverlight 3

CSharp, Development, Silverlight 3 Comments »

Gracias a WriteableBitmap podemos realizar la manipulación de imágenes en Silverlight 3. En este ejemplo, realizaremos la conversión de la imagen fuente de un control Image a su par en escarla de grises. Aplicaremos una fórmula de conversión a nivel de bytes del pixel (obtenido inicialmente como entero).

void MakeGray(Image img)
{
    WriteableBitmap bitmap = new WriteableBitmap(img,null);
    for (int y = 0; y < bitmap.PixelHeight; y++)
    {
        for (int x = 0; x < bitmap.PixelWidth; x++)
        {
            //obtiene pixel a pixel
            int pixelLocation = bitmap.PixelWidth * y + x;
            int pixel = bitmap.Pixels[pixelLocation];

            byte[] pixelBytes = BitConverter.GetBytes(pixel);
            byte bwPixel = (byte)(.299 * pixelBytes[2]
                                  + .587 * pixelBytes[1]
                                  + .114 * pixelBytes[0]);
            pixelBytes[0] = bwPixel;//b
            pixelBytes[1] = bwPixel;//g
            pixelBytes[2] = bwPixel;//r
            //la posición 3 es el alpha
            bitmap.Pixels[pixelLocation] = BitConverter.ToInt32(pixelBytes,0);
        }
    }
    img.Source = bitmap;
}

image

image

Referencias:

Espero haya sido de utilidad :)

Post.End();

Differences between POCO and DTO

Architecture, CSharp, Design patterns No Comments »

by Paul Lorena

Introduction

POCO is the acronym for the Plain Old CLR Object, and its goal is describe a typical class or object in .NET, was coined at the beginning by Martin Fowler to describe the same concept in Java (POJO). In other hand DTO (Data Transfer Object) like its name says it’s the an object with only one responsibility : Persist Data. this post came to clarify my thoughts about this subject, or to help to consolidate them.

Data transfer object (DTO)

  • Is an object for storage/retrieval data
  • Doesn’t have any business logic

image

Plain Object CLR Old (POCO)

  • Has a business logic
  • Is a “persistence ignorant”
  • Doesn’t have the responsibility to maintain the data

image

How do they work together?

Interesting question, here we can see 2 objects with a responsibility very explicit, to put this to work we need to do a reference in the POCO object (in this case Student) to the DTO object (Student_DTO), this a dependency relationship, not a heritance case. Not enough! because a DTO has the responsibility to transfer the data, so we need to create a new object to do that…

image

The final picture looks like this

image

Patrones de Expresión Regular

CSharp, Cidesoft, Development, Productivity No Comments »

Nociones Basicas

Regular Expressions, Regex.  Se define como un conjunto de caracteres que al ser comparadas a una cadena verifican que cumpla ciertos requerimientos de formato.

Tambien se utilizan para extraer porciones de texto y/o actualizar texto cambiando caracteres o su formato en si­.

Aca tenemos algunos caracteres y formas utilizados en los regex

^ para coincidir con el inicio de la cadena
$ para coincidir con el final de la cadena
\Z para coincidir con el ultimo caracter o salto de li­nea
\z para coincidir con el ultimo caracter de la fila
* cero o mas repeticiones
+ una o mas repeticiones
a{#min, #max} numero de apariciones del caracter ‘a’ de #min a #max. Si no se especifica #max seri­a como mi­nimo #min caracteres ‘a’.
? caracter opcional (cero o uno de tal caracter)
. caracter opcional (uno o uno de tal caracter)
[a-z,A-Z] caracteres dentro de un rango determinado, para este ejemplo de ‘a’ a ‘z’ y de ‘A’ a ‘Z’
\d cualquier numero

Nota: Los ejemplos a continuacion se prueban en LINQPad. A opinion personal, lo recomiendo para este tipo de pruebas que crear todo un pequeño proyecto en Visual Studio.

Para caracteres especiales a ser utilizados, usar el ‘\’ y el caracter deseado.

Hay que recordar que las expresiones son Case-Sensitive. Pasemos a ver algunas clases de System.Text.RegularExpressions

Clase Regex

Es una clase que contiene la expresion regular de manera inmutable. Presenta tambien metodos estaticos para su uso. Podemos usar el metodo IsMatch(input, regexPattern) para validar coincidencias de la cadena de entrada con el patron de expresion regular:

   1: void Main()

   2: {

   3:     /* Forma 1*/    

   4:     string.Format("{0} Coincide con el patron de expresion regular", Regex.IsMatch(@"b",@"^[a-zA-Z]*$")?"Si":"No").Dump();

   5:     

   6:     /* Forma 2*/

   7:     Regex rgx = new Regex(@"^\d{1,}\.?\d{0,4}$");

   8:     string.Format("{0} Coincide con el patron de expresion regular", rgx.IsMatch(@"12.012")?"Si":"No").Dump();

   9: }

Clase Match

Es una clase que hace una busqueda de coincidencias. Tambien ayuda a extraer las mismas.

   1: void Main()

   2: {    

   3:     Match m = Regex.Match(@"abc123 cde212 123", @"[a-z]+(\d*)");

   4:     if(m.Success){

   5:         int i=0, n = m.Length;

   6:         "Solo los que coinciden".Dump();

   7:         while(i < n){

   8:             m.Value.Dump();

   9:             m = m.NextMatch();        

  10:             i++;

  11:         }

  12:     }

  13: }

Ahora tenemos un ejemplo para reemplazar contenido con ayuda de Regex.

   1: void Main()

   2: {    

   3:     string pattern = @"\d+"; //los numeros, en una o mas repeticiones

   4:     string input = @"a123b0c999d"; //dentro de esta entrada

   5:     string output = Regex.Replace(input, pattern,"-"); //seran reemplazados por guiones

   6:     output.Dump();

   7: }

Read the rest of this entry »

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in