miércoles, 1 de octubre de 2014

El Libro del Día: jQuery Mobile, Up and Running

El Libro del Día: 2014-10-01

Titulo: jQuery Mobile, Up and Running
Autor: Maximiliano Firtman
Editorial: O'Reilly
Nro Paginas: 270

Capítulos:
1. The Mobile Platform
2. Starting with the Framework
3. UI Components
4. Lists
5. Form Components
6. The Framework and JavaScript
7. Creating Themes
8. Installation and Offline Access
9. A Complete Webapp
10. Extending the Framework
11. Packaging for Stores

Descarga:
jQuery_Mobile_UpAndRunning

martes, 30 de septiembre de 2014

El Libro del Día: JavaScript & jQuery The Missing Manual

El Libro del Día: 2014-09-30

Titulo: JavaScript & jQuery The Missing Manual
Autor: David Sawyer McFarland
Editorial: O'Reilly
Nro Paginas: 538

Capítulos:
Part One: Getting Started with JavaScript
Chapter 1: Writing Your First JavaScript Program
Chapter 2: The Grammar of JavaScript
Chapter 3: Adding Logic and Control to Your Programs
Part Two: Getting Started with jQuery
Chapter 4: Introducing jQuery
Chapter 5: Action/Reaction: Making Pages Come Alive with Events
Chapter 6: Animations and Effects
Part Three: Building Web Page Features
Chapter 7: Improving Your Images
Chapter 8: Improving Navigation
Chapter 9: Enhancing Web Forms
Chapter 10: Expanding Your Interface
Part Four: Ajax: Communication with the Web Server
Chapter 11: Introducing Ajax
Chapter 12: Flickr and Google Maps
Part Five: Tips, Tricks, and Troubleshooting
Chapter 13: Getting the Most from jQuery
Chapter 14: Going Further with JavaScript
Chapter 15: Troubleshooting and Debugging
Appendix A: JavaScript Resources

Descarga:
JavaScript_jQuery_TheMissingManual

lunes, 29 de septiembre de 2014

El Libro del Día: Extending jQuery

El Libro del Día: 2014-09-29

Titulo: Extending jQuery
Autor: Keith Wood
Editorial: Manning
Nro Paginas: 311

Capítulos:
PART 1 SIMPLE EXTENSIONS
1. jQuery extensions
2. A first plugin
3. Selectors and filters
PART 2 PLUGINS AND FUNCTIONS
4. Plugin principles
5. Collection plugins
6. Function plugins
7. Test, package, and document your plugin
PART 3 EXTENDING JQUERY UI
8. jQuery UI widgets
9. jQuery UI mouse interactions
10. jQuery UI effects
PART 4 OTHER EXTENSIONS
11. Animating properties
12. Extending Ajax
13. Extending events
14. Creating validation rules

Descarga:
Extending_jQuery

domingo, 28 de septiembre de 2014

El Libro del Día: Learning jQuery (Fourth Edition)

El Libro del Día: 2014-09-28

Titulo: Learning jQuery (Fourth Edition)
Autor: Jonathan Chaffer, Karl Swedberg
Editorial: Packt
Nro Paginas: 444

Capítulos:
Chapter 1: Getting Started
Chapter 2: Selecting Elements
Chapter 3: Handling Events
Chapter 4: Styling and Animating
Chapter 5: Manipulating the DOM
Chapter 6: Sending Data with Ajax
Chapter 7: Using Plugins
Chapter 8: Developing Plugins
Chapter 9: Advanced Selectors and Traversing
Chapter 10: Advanced Events
Chapter 11: Advanced Effects
Chapter 12: Advanced DOM Manipulation
Chapter 13: Advanced Ajax
Appendix A: JavaScript Closures
Appendix B: Testing JavaScript with QUnit
Appendix C: Quick Reference

Descarga:
Learning_jQuery

sábado, 27 de septiembre de 2014

El Libro del Día: Learning from jQuery

El Libro del Día: 2014-09-27

Titulo: Learning from jQuery
Autor: Callum Macrae
Editorial: O'Reilly
Nro Paginas: 116

Capítulos:
1. Event Handling
2. Constructors and Prototypes
3. DOM Traversal and Manipulation
4. AJAX
5. JavaScript Conventions
A. JavaScript Basics
B. JavaScript Resources

Descarga:
Learning_From_jQuery

viernes, 26 de septiembre de 2014

El Demo del Día: Visor de Imágenes con Zoom en WinForms

Visor de Imágenes con Zoom en WinForms

Este post es a pedido de un alumno que quiere una aplicación en Windows Forms que muestre una secuencia de Imágenes y pueda realizar el Zoom.

Crear la Aplicación Windows Forms

Primero crearemos una aplicación en Windows Forms en C# llamada: "VisorImagenesZoom".
Cambiar de nombre al formulario por el de "frmVisor", luego diseñar la pantalla como se muestra en la siguiente figura:


Nota: También hay que incluir un Timer llamado "tmrPreview" que cada 3 segundos muestre las imágenes del directorio seleccionado.

Escribir el siguiente código en el formulario:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.IO;

namespace VisorImagenesZoom
{
    public partial class frmVisor : Form
    {
        private int c;
        private int n;
        private Point punto1;

        public frmVisor()
        {
            InitializeComponent();
        }

        private void abrirDirectorio(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            if (fbd.ShowDialog().Equals(DialogResult.OK))
            {
                txtDirectorio.Text = fbd.SelectedPath;
                IEnumerable<string> archivos = Directory.EnumerateFiles(fbd.SelectedPath, "*.jpg");
                lstArchivo.Items.Clear();
                lstArchivo.BeginUpdate();
                foreach (string archivo in archivos)
                {
                    lstArchivo.Items.Add(Path.GetFileNameWithoutExtension(archivo));
                }
                lstArchivo.EndUpdate();
                txtTotalArchivos.Text = lstArchivo.Items.Count.ToString();
                tmrPreview.Enabled = true;
                tmrPreview.Start();
            }
        }

        private void mostrarImagenes(object sender, EventArgs e)
        {
            lstArchivo.SelectedIndex = c;
            string archivo = Path.Combine(txtDirectorio.Text, lstArchivo.Items[c].ToString() + ".jpg");
            picPreview.LoadAsync(archivo);
            c++;
            if (c == lstArchivo.Items.Count) c = 0;
        }

        private void configurarZoom(object sender, MouseEventArgs e)
        {
            if (e.Button.Equals(MouseButtons.Left))
            {
                if (n == 0)
                {
                    punto1 = e.Location;
                    tmrPreview.Stop();
                    tmrPreview.Enabled = false;
                }
                else
                {
                    if (n == 1)
                    {
                        Point punto2 = e.Location;
                        string archivo = Path.Combine(txtDirectorio.Text,
                                                   lstArchivo.Items[c].ToString() + ".jpg");
                        Bitmap bmp = new Bitmap(picPreview.Image);
                        Bitmap bmpZoom = new Bitmap(bmp.Width, bmp.Height);
                        Graphics g = Graphics.FromImage(bmpZoom);
                        float ratioX = (bmp.Width/picPreview.Width);
                        float ratioY = (bmp.Height / picPreview.Height);
                        int posX = (int)(ratioX * punto1.X);
                        int posY = (int)(ratioY * punto1.Y);
                        int ancho = (int)(ratioX*(punto2.X-punto1.X));
                        int alto = (int)(ratioY * (punto2.Y - punto1.Y));
                        Rectangle srcRect = new Rectangle(posX, posY, ancho, alto);
                        Rectangle dstRect = new Rectangle(0, 0, bmpZoom.Width, bmpZoom.Height);
                        g.DrawImage(bmp, dstRect, srcRect, GraphicsUnit.Pixel);
                        picPreview.Image = bmpZoom;
                        tmrPreview.Enabled = true;
                        tmrPreview.Start();
                    }
                }
                n++;
                if (n == 2) n = 0;
            }
        }
    }
}

Nota: Para programar el Zoom se ha asociado al evento MouseClick del PictureBox llamado "picPreview" donde en el primer clic se captura la ubicación del punto y se guarda en una variable "punto1" y en el segundo clic se captura el punto2 y se crea un rectangulo con la imagen para el Zoom. Solo hay que tener en cuenta que el Rectangulo debe ser en base a la imagen (Bitmap) del PictureBox y No al tamaño del control (con propiedad SizeMode en StrechImage), por lo cual se crea las variables ratios.

Probar la Aplicación Creada

Grabar el proyecto y ejecutarlo con F5. Seleccionar un directorio donde se encuentren archivos jpg y se mostraran en la lista tal como aparece en la siguiente figura:


Cada 3 segundos cambiara la imagen y se seleccionara en la lista el archivo que se esta mostrando, dar el primer clic sobre la imagen y luego el segundo clic mostrará el preview de la imagen, tal como sigue:


Comentario Final

En este post hemos visto como mostrar una secuencia de imágenes usando un Timer y también como realizar el Zoom de una Imagen usando el método DrawImage de la clase Graphics para dibujar un rectángulo con la imagen especificada al dar dos clics, uno para marcar el punto de inicio y otro para marcar el punto final.

Descarga:
Demo19_VisorImagenesZoom



El Libro del Día: jQuery Mobile Cookbook

El Libro del Día: 2014-09-26

Titulo: jQuery Mobile Cookbook
Autor: Chetan K Jain
Editorial: Packt
Nro Paginas: 320

Capítulos:
Chapter 1: Get Rolling
Chapter 2: Pages and Dialogs
Chapter 3: Toolbars
Chapter 4: Buttons and Content Formatting
Chapter 5: Forms
Chapter 6: List Views
Chapter 7: Configurations
Chapter 8: Events
Chapter 9: Methods and Utilities
Chapter 10: The Theme Framework
Chapter 11: HTML5 and jQuery Mobile

Descarga:
jQuery_Mobile_Cookbook