tag:blogger.com,1999:blog-27405260335154566382024-03-13T18:55:09.553-06:00El Blog del Dr. Omm...La Ausencia de Prueba... No significa Prueba de AusenciaDr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.comBlogger58125tag:blogger.com,1999:blog-2740526033515456638.post-69742783170792529412012-04-04T20:34:00.007-05:002012-04-04T21:01:12.475-05:00Funcion para Calcular Horas entre 2 Fechas descartando Fines de Semana SQL Server<div style="text-align: justify;"><span style="font-size: 100%; ">En <i>SQL Server</i> existe la funcion </span> <span style="color: rgb(255, 0, 255); font-family: 'Courier New'; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); ">dateDiff</span><span style="font-size: 100%; "> </span><span style="font-size: 100%; "> que devuelve la cantidad de días, horas, semanas, etc. entre dos fechas. Para mas información pueden revisar la documentación de <a href="http://msdn.microsoft.com/es-es/library/ms189794.aspx">msdn</a>. Esta función es muy útil para realizar cálculos especiales, como antigüedad de registros o el tiempo de vida de alguna persona.</span></div><div style="text-align: justify;font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span ><br /></span></div><div style="text-align: justify;font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span >Sin embargo, en casos más especiales, se requeriría calcular el tiempo entre 2 fechas, pero solamente contando los días laborales. Lamentablemente, </span><span style="color: rgb(255, 0, 255); font-family: 'Courier New'; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); ">dateDiff</span><span style="font-size: 100%; "> </span><span style="font-size: 100%; "> </span><span style="font-family: arial; font-size: 100%; ">no cuenta con algún parámetro para esto, por lo que hay que aplicar un poco de lógica para conseguirlo.</span></div><div style="text-align: justify;font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-family: arial; font-size: 100%; "><br /></span></div><div style="text-align: justify;"><span >Basándome</span><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "> en un <a href="http://www.forosdelweb.com/f15/function-dias-no-laborables-282012/">enlace</a> construí una función que devolviera la cantidad de horas transcurridas entre 2 fechas, descontando fines de semana. Tal vez no sea la mejor manera, o las más optimizada, pero cumple decentemente su objetivo.</span></div><div><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "><br /></span></div><div><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">SET</span><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">ANSI_NULLS</span> <span style="color: blue; ">ON<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; ">GO<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">SET</span><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">QUOTED_IDENTIFIER</span> <span style="color: blue; ">ON<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; ">GO</span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">ALTER</span><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">FUNCTION</span> diffHoursWithoutWeekend<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: gray; ">(<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> @fInicio <span style="color: blue; ">smalldatetime</span><span style="color: gray; ">,<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> @fFin <span style="color: blue; ">smalldatetime<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: gray; ">)<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">RETURNS</span><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">int<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">AS<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">BEGIN<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">declare</span> @noHoras <span style="color: blue; ">int<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">declare</span> @cuentaLab <span style="color: blue; ">int<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">declare</span> @contador <span style="color: blue; ">int<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">select</span> @noHoras <span style="color: gray; ">=</span> <span style="color: fuchsia; ">dateDiff</span><span style="color: gray; ">(</span>hour<span style="color: gray; ">,</span> @fInicio<span style="color: gray; ">,</span> @fFin<span style="color: gray; ">)<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">select</span> @cuentaLab <span style="color: gray; ">=</span> 0<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">select</span> @contador <span style="color: gray; ">=</span> 0<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">while</span><span style="color: gray; ">(</span>@contador <span style="color: gray; "><</span> @noHoras<span style="color: gray; ">)<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">begin<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">declare</span> @diaSemana <span style="color: blue; ">int<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">select</span> @diaSemana <span style="color: gray; ">=</span> <span style="color: fuchsia; ">datePart</span><span style="color: gray; ">(</span>weekDay<span style="color: gray; ">,</span> <span style="color: fuchsia; ">dateAdd</span><span style="color: gray; ">(</span>"hh"<span style="color: gray; ">,</span> @contador<span style="color: gray; ">,</span> @fInicio<span style="color: gray; ">))<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">if</span> <span style="color: gray; ">(</span>@diaSemana <span style="color: gray; "><></span> 1 <span style="color: gray; ">and</span> @diaSemana <span style="color: gray; "><></span> 7<span style="color: gray; ">)<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">begin<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">select</span> @cuentaLab <span style="color: gray; ">=</span> @cuentaLab <span style="color: gray; ">+</span> 1<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">end<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">select</span> @contador <span style="color: gray; ">=</span> @contador <span style="color: gray; ">+</span> 1<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">end<u></u><u></u></span></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color: blue; ">RETURN</span> @cuentaLab<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">END<u></u><u></u></span></p><p class="MsoNormal" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969); "><span style="font-size: 10pt; font-family: 'Courier New'; ">GO</span></p></div><div><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "><br /></span></div><div style="text-align: justify;"><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; ">Como pueden ver, la función recibe como parámetros de entrada 2 fechas para posteriormente calcular las horas entre ambas. Posteriormente utilizando un ciclo, por cada hora transcurrida determinamos si es fin de semana (por defecto en </span><span style="font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "><i>SQL Server</i></span><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; ">, </span><span style="font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "><i>Domingo</i></span><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "> es 1, </span><span style="font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "><i>Lunes</i></span><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "> es 2, etc). En caso de que sea un día laboral, aumentamos el contador de las horas.</span></div><div><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "><br /></span></div><div><span >La función puede ser fácilmente transformada para que devuelva la cantidad de días. En el enlace indicado viene un ejemplo que lo puede mostrar, así como también una solución propuesta para los casos que se desee descartar días feriados.</span></div><div><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; "><br /></span></div><div><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-family: arial; font-size: 100%; ">Espero les sea útil y cualquier comentario o mejora es bienvenida.</span></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com1tag:blogger.com,1999:blog-2740526033515456638.post-79005621309187266372012-03-18T19:59:00.030-06:002012-04-21T15:14:12.533-05:00Ejecutar PostBack de un control con C# y Javascript<div style="font-family: Georgia, serif; font-size: 100%; text-align: justify; "><span style="font-size: 100%; font-family: arial; text-align: left; ">Buscando información de como subir imágenes al servidor utilizando <i>ASP.NET</i>, me encontré con un </span><a href="http://trytocatch.wordpress.com/2007/10/08/fileupload-e-imagenthunbail/" style="font-size: 100%; font-family: arial; text-align: left; ">artículo</a><span style="font-size: 100%; font-family: arial; text-align: left; "> interesante, que muestra un ejemplo sobre el tema donde resalta como ejecutar el evento <b>PostBack</b> de un <i>linkButton</i>, utilizando el método <b>__doPostBack</b> en <i>Javascript</i>.</span></div><div style="font-family: Georgia, serif; text-align: justify; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-family: Georgia, serif; font-size: 100%; text-align: justify; "><span><span style="font-size: 100%;">Lo que hace el siguiente código es utilizar un control <b>fileUpload</b> para subir una </span>imagen<span style="font-size: 100%;">. Lo que hace diferente es que no utiliza un botón extra para ejecutar el postback y enviar el archivo al servidor, si no que al momento de que el usuario lo selecciona, se ejecuta el evento de un linkButton oculto que tiene el código necesario para subir la </span>imagen<span style="font-size: 100%;">.</span></span></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-family: Georgia, serif; text-align: justify; font-size: 100%; font-variant: normal; line-height: normal; "><span>Esto se logra invocando el método <b style="font-style: normal; ">__doPostBack</b>, seleccionando el control que se desea ejecutar. De esta manera, desde <i>javascript</i> podemos invocar el <i>code behind</i> que necesitemos para lograr un objetivo.</span></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-family: Georgia, serif; text-align: justify; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span>Además, el ejemplo muestra como crear un thumbnail o vista previa de la imágen y se pregunta al usuario si desea guardarla o no. Ya esto último es extra y puede caer en discusión su funcionalidad.</span></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span>Los controles principales que se necesitan son:</span></div><div style="font-family: Georgia, serif; font-size: 100%; font-variant: normal; line-height: normal; "><ul><li><span style="font-family: arial; font-size: 100%; "><b style="font-style: normal; ">FileUpload</b> de nombre <i>fileUpload</i>.</span></li><li><span style="font-family: arial; font-size: 100%; "><b style="font-style: normal; ">HiddenField </b>de nombre <i>hdFileName</i></span></li><li><span style="font-family: arial; font-size: 100%; "><b style="font-style: normal; ">HiddenField </b>de nombre <i>hdFileNameThumb</i></span></li><li><span style="font-family: arial; font-size: 100%; "><b style="font-style: normal; ">LinkButton </b>de nombre <i>linkBt</i></span></li><li><span style="font-family: arial; font-size: 100%; "><b style="font-style: normal; ">Button </b>de nombre <i>btGuardar</i></span></li><li><span style="font-family: arial; font-size: 100%; "><b style="font-style: normal; ">Button </b>de nombre <i>btCancelar</i></span></li><li><span style="font-family: arial; font-size: 100%; "><b style="font-style: normal; ">Image </b>de nombre <i>image</i></span></li></ul></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-family: arial; ">Además n</span><span style="font-family: arial; font-size: 100%; ">ecesitamos los siguientes espacios de nombre:</span></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; "><br /></span></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">using</span><span style="font-size: 10pt; font-family: 'Courier New'; "> System.IO;</span></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">using</span><span style="font-size: 10pt; font-family: 'Courier New'; "> System.Drawing.Imaging;</span></div><div><div style="font-size: 100%; font-family: arial; "><br /></div><div style="font-size: 100%; font-family: arial; ">Y el código es el siguiente:</div><div style="font-size: 100%; font-family: arial; "><br /></div><div style="font-size: 100%; font-family: arial; ">Las funciones Javascript:</div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21); "><br /></span></div><div><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">var</span><span style="font-size: 10pt; font-family: 'Courier New'; "> x = 5000;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">var</span><span style="font-family: 'Courier New'; font-size: 10pt; "> Guardar;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">function</span><span style="font-family: 'Courier New'; font-size: 10pt; "> asignarRutaImagen()</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span>/*Esta funcion esperara hasta que el usuario haya elegido un archivo*/</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">var</span><span style="font-family: 'Courier New'; font-size: 10pt; "> tiempo, tiempo2;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">if</span><span style="font-family: 'Courier New'; font-size: 10pt; ">(x >= 0)</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> <span class="Apple-tab-span" style="white-space:pre"> </span></span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">x-=1;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">if</span><span style="font-family: 'Courier New'; font-size: 10pt; "> (document.form1.fileUpload.value == </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">""</span><span style="font-family: 'Courier New'; font-size: 10pt; ">)</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">tiempo2 = setTimeout(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"asignarRutaImagen()"</span><span style="font-family: 'Courier New'; font-size: 10pt; ">, 50);</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">else</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">document.form1.hdFileName.value =</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span>document.form1.fileUpload.value;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-size: 10pt; font-family: 'Courier New'; ">x=-1;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Genera un postback e invoca el evento </span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span>click del linkbutton*/</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">__doPostBack(<span style="color:#A31515">'linkBt'</span>,<span style="color:#A31515">''</span>);</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">function</span><span style="font-family: 'Courier New'; font-size: 10pt; "> validarkey()</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-size: 10pt; font-family: 'Courier New'; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Para que use el browse y no teclee la ruta*/</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">alert (</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"Presione el boton Browse para buscar una imagen"</span><span style="font-family: 'Courier New'; font-size: 10pt; ">);</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">return</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color:blue">false</span>;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div><span><br /></span></div><div style="font-size: 100%; font-family: arial; ">El CodeBehind:</div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; "><br /></span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">protected</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color:blue">void</span> Page_Load(<span style="color:blue">object</span> sender, <span style="color:#2B91AF">EventArgs</span> e)</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="color: green; font-family: 'Courier New'; font-size: 10pt; text-indent: 35.4pt; "><span class="Apple-tab-span" style="white-space:pre"> </span>/*Hacemos limpieza del buffer y encabezados*/</span></div><div style="font-size: 100%; font-family: arial; "><span style="color: green; font-family: 'Courier New'; font-size: 10pt; text-indent: 35.4pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; color: blue; ">this</span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; ">.Response.BufferOutput = <span style="color:blue">false</span>;</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; color: blue; ">this</span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; ">.Response.Clear();</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; color: blue; ">this</span><span style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; ">.Response.ClearHeaders();</span></div><div style="font-size: 100%; font-family: arial; "><span style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="color: green; font-family: 'Courier New'; font-size: 10pt; text-indent: 35.4pt; ">/*Agregamos al FileUpload, a sus eventos onclick y onkeypress,</span></div><div style="font-size: 100%; font-family: arial; "><span style="color: green; font-family: 'Courier New'; font-size: 10pt; text-indent: 35.4pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="color: green; font-family: 'Courier New'; font-size: 10pt; text-indent: 35.4pt; ">las funciones asignarRutaFoto y validarKey*/</span></div><div style="font-size: 100%; font-family: arial; "><span style="color: green; font-family: 'Courier New'; font-size: 10pt; text-indent: 35.4pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; color: blue; ">this</span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; ">.fileUpload.Attributes.Add(<span style="color:#A31515">"onclick"</span>,</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21); ">"javascript:asignarRutaImagen();"</span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; ">);</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; color: blue; ">this</span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; ">.fileUpload.Attributes.Add(<span style="color:#A31515">"onkeypress"</span>,</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21); ">"javascript:return validarkey();"</span><span lang="EN-US" style="text-indent: 35.4pt; font-size: 10pt; font-family: 'Courier New'; ">);</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; "><br /></span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">protected</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> <span style="color:blue">void</span> linkBt_Click(<span style="color:blue">object</span> sender, <span style="color:#2B91AF">EventArgs</span> e)</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-size: 10pt; font-family: 'Courier New'; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">try</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Este evento se generara desde la funcion javascript</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span>asignarRutaFoto*/</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">if</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> (<span style="color:blue">this</span>.fileUpload.HasFile == <span style="color:blue">true</span>)</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-size: 10pt; font-family: 'Courier New'; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">cargarFotografia();</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">mostrarImagen();</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.btGuardar.Visible = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">true</span><span style="font-family: 'Courier New'; font-size: 10pt; ">;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">this</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">.btCancelar.Visible = <span style="color:blue">true</span>;</span></div><div style="font-size: 100%; font-family: arial; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 13px; color: blue; ">catch</span><span style="font-family: 'Courier New'; font-size: 13px; "> (</span><span style="font-family: 'Courier New'; font-size: 13px; color: rgb(43, 145, 175); ">Exception</span><span style="font-family: 'Courier New'; font-size: 13px; "> ex)</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 13px; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.lblMsg.Text = ex.Message;</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-size: 10pt; font-family: 'Courier New'; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; "><br /></span></div><div style="font-size: 100%; font-family: arial; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">private</span><span style="font-family: 'Courier New'; font-size: 10pt; "> </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">void</span><span style="font-family: 'Courier New'; font-size: 10pt; "> cargarFotografia()</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span>/</span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">*Obtenemos el nombre y la extension del archivo*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175); ">String</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> fileName = <span style="color:#2B91AF">Path</span>.GetFileName(<span style="color:blue">this</span>.fileUpload.PostedFile.FileName);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">String</span><span style="font-family: 'Courier New'; font-size: 10pt; "> extension = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">Path</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.GetExtension(</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span>this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.fileUpload.PostedFile.FileName).ToLower();</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="color: blue; font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span>try</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="color: blue; font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span style="color:blue">if</span> (extension != <span style="color:#A31515">".png"</span> && extension != </span><span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(163, 21, 21); ">".jpg"</span><span style="font-size: 10pt; font-family: 'Courier New'; "> && </span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span>extension != <span style="color:#A31515">".bmp"</span>)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.lblMsg.Text = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"El archivo ingresado no es una imagen"</span><span style="font-family: 'Courier New'; font-size: 10pt; ">;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">else</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Se guarda la imagen en el servidor*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">this</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">.fileUpload.PostedFile.SaveAs(</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span>Server.MapPath(<span style="color:#A31515">"\\imagesTemp\\"</span>) + fileName);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-size: 10pt; font-family: 'Courier New'; color: green; ">/*Obtenemos el nombre temporal de la imagen </span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span>con la siguiente funcion*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">String</span><span style="font-family: 'Courier New'; font-size: 10pt; "> nombreImgServer = getNombreImagenServidor(extension);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value = nombreImgServer;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Cambiamos el nombre de la imagen por el nuevo*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175); ">File</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">.Move(Server.MapPath(<span style="color:#A31515">"\\imagesTemp\\"</span>) + fileName,</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span>Server.MapPath(<span style="color:#A31515">"\\imagesTemp\\"</span> + nombreImgServer));</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">catch</span><span style="font-family: 'Courier New'; font-size: 10pt; "> (</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">Exception</span><span style="font-family: 'Courier New'; font-size: 10pt; "> ex)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.lblMsg.Text = ex.Message;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><br /></span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">public</span><span style="font-family: 'Courier New'; font-size: 10pt; "> </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">String</span><span style="font-family: 'Courier New'; font-size: 10pt; "> getNombreImagenServidor(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">String</span><span style="font-family: 'Courier New'; font-size: 10pt; "> extension)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Devuelve el nombre temporal de la imagen*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175); ">Random</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> nRandom = <span style="color:blue">new</span> <span style="color:#2B91AF">Random</span>();</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">String</span><span style="font-family: 'Courier New'; font-size: 10pt; "> nr = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">Convert</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.ToString(nRandom.Next(0, 32000));</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">String</span><span style="font-family: 'Courier New'; font-size: 10pt; "> nombre = nr + </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"_"</span><span style="font-family: 'Courier New'; font-size: 10pt; "> + </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">DateTime</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.Today.ToString(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"ddMMyyyy"</span><span style="font-family: 'Courier New'; font-size: 10pt; ">) + extension;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">nRandom = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">null</span><span style="font-family: 'Courier New'; font-size: 10pt; ">;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">return</span><span style="font-family: 'Courier New'; font-size: 10pt; "> nombre;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><br /></span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">private</span><span style="font-family: 'Courier New'; font-size: 10pt; "> </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">void</span><span style="font-family: 'Courier New'; font-size: 10pt; "> mostrarImagen()</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Muestra la imagen como un thumbnail*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">System.Drawing.<span style="color:#2B91AF">Image</span> objImage = <span style="color:blue">null</span>, objThumbnail = <span style="color:blue">null</span>;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">Int32</span><span style="font-family: 'Courier New'; font-size: 10pt; "> width, height;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">String</span><span style="font-family: 'Courier New'; font-size: 10pt; "> fileName = Server.MapPath(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"imagesTemp\\"</span><span style="font-family: 'Courier New'; font-size: 10pt; ">) +</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); "><span class="Apple-tab-span" style="white-space:pre"> </span>Path</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.GetFileName(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> </span><span style="font-size: 10pt; font-family: 'Courier New'; color: rgb(43, 145, 175); ">Stream</span><span style="font-size: 10pt; font-family: 'Courier New'; "> stream = <span style="color:blue">null</span>;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">try</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Se guarda la imagen en un stream para despues colocarla </span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span>en un objeto para que la imagen no quede abierta en el servidor*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">stream = <span style="color:#2B91AF">File</span>.OpenRead(fileName);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">objImage = System.Drawing.</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">Image</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.FromStream(stream);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">width = 100;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">height = objImage.Height / (objImage.Width / width);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">this</span><span style="font-size: 10pt; font-family: 'Courier New'; ">.Response.Clear();</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Se crea el thumbnail y se muestra en la imagen*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">objThumbnail = objImage.GetThumbnailImage(</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span>width, height, <span style="color:blue">null</span>, <span style="color:#2B91AF">IntPtr</span>.Zero);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">objThumbnail.Save(Server.MapPath(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"imagesTemp\\"</span><span style="font-family: 'Courier New'; font-size: 10pt; ">) + </span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); "><span class="Apple-tab-span" style="white-space:pre"> </span>"thumb_"</span><span style="font-family: 'Courier New'; font-size: 10pt; "> + </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value, </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">ImageFormat</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.Jpeg);</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.image.Visible = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">true</span><span style="font-family: 'Courier New'; font-size: 10pt; ">;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">String</span><span style="font-family: 'Courier New'; font-size: 10pt; "> nombreImgThumb = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"thumb_"</span><span style="font-family: 'Courier New'; font-size: 10pt; "> + </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileNameThumb.Value = nombreImgThumb;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.image.ImageUrl = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"~/imagesTemp//"</span><span style="font-family: 'Courier New'; font-size: 10pt; "> + nombreImgThumb;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">catch</span><span style="font-family: 'Courier New'; font-size: 10pt; ">(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">Exception</span><span style="font-family: 'Courier New'; font-size: 10pt; "> ex)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.lblMsg.Text = ex.Message;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-size: 10pt; font-family: 'Courier New'; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">finally</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span>/</span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">*Limpiamos los objetos*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">objImage.Dispose();</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; ">objThumbnail.Dispose();</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">stream.Dispose();</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">objImage = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">null</span><span style="font-family: 'Courier New'; font-size: 10pt; ">;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">objThumbnail = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">null</span><span style="font-family: 'Courier New'; font-size: 10pt; ">;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">stream = </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">null</span><span style="font-family: 'Courier New'; font-size: 10pt; ">;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><br /></span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">protected</span><span style="font-family: 'Courier New'; font-size: 10pt; "> </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">void</span><span style="font-family: 'Courier New'; font-size: 10pt; "> btGuardar_Click(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">object</span><span style="font-family: 'Courier New'; font-size: 10pt; "> sender, </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">EventArgs</span><span style="font-family: 'Courier New'; font-size: 10pt; "> e)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">try</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Borramos la imagen thumbnail y movemos la imagen elegida a la </span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span>carpeta correcta*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">if</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> (<span style="color:blue">this</span>.hdFileNameThumb.Value.Length > 0)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">File</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.Delete(Server.MapPath(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"\\imagesTemp\\"</span><span style="font-family: 'Courier New'; font-size: 10pt; "> +</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span>this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileNameThumb.Value));</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">if</span><span style="font-family: 'Courier New'; font-size: 10pt; "> (</span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value.Length > 0)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">File</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.Move(Server.MapPath(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"\\imagesTemp\\"</span><span style="font-family: 'Courier New'; font-size: 10pt; ">) +</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span>this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value, Server.MapPath(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"\\images\\"</span><span style="font-family: 'Courier New'; font-size: 10pt; "> +</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span>this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value));</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span>c</span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">atch</span><span style="font-family: 'Courier New'; font-size: 10pt; "> (</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">Exception</span><span style="font-family: 'Courier New'; font-size: 10pt; "> ex)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.lblMsg.Text = ex.Message;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span>}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><br /></span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">protected</span><span style="font-family: 'Courier New'; font-size: 10pt; "> </span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">void</span><span style="font-family: 'Courier New'; font-size: 10pt; "> btCancelar_Click(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">object</span><span style="font-family: 'Courier New'; font-size: 10pt; "> sender, </span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">EventArgs</span><span style="font-family: 'Courier New'; font-size: 10pt; "> e)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">try</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: green; ">/*Borramos las imagenes de la carpeta temporal*/</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; color: green; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; color: blue; ">if</span><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "> (<span style="color:blue">this</span>.hdFileNameThumb.Value.Length > 0)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span lang="EN-US" style="font-size: 10pt; font-family: 'Courier New'; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">File</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.Delete(Server.MapPath(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"\\imagesTemp\\"</span><span style="font-family: 'Courier New'; font-size: 10pt; "> +</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span>this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileNameThumb.Value));</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span>}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">if</span><span style="font-family: 'Courier New'; font-size: 10pt; "> (</span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value.Length > 0)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">File</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.Delete(Server.MapPath(</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(163, 21, 21); ">"\\imagesTemp\\"</span><span style="font-family: 'Courier New'; font-size: 10pt; "> +</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; "><span class="Apple-tab-span" style="white-space:pre"> </span>his</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.hdFileName.Value));</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">catch</span><span style="font-family: 'Courier New'; font-size: 10pt; "> (</span><span style="font-family: 'Courier New'; font-size: 10pt; color: rgb(43, 145, 175); ">Exception</span><span style="font-family: 'Courier New'; font-size: 10pt; "> ex)</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; ">{</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-family: 'Courier New'; font-size: 10pt; color: blue; ">this</span><span style="font-family: 'Courier New'; font-size: 10pt; ">.lblMsg.Text = ex.Message;</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; "><span class="Apple-tab-span" style="white-space:pre"> </span></span><span style="font-size: 10pt; font-family: 'Courier New'; ">}</span></div><div style="font-family: Georgia, serif; font-size: 100%; "><span style="font-family: 'Courier New'; font-size: 10pt; ">}</span></div><div style="font-size: 100%; font-family: arial; "><br /></div><div style="font-size: 100%; font-family: arial; ">Les dejo algunas imágenes de su funcionamiento y la liga al <a href="https://skydrive.live.com/#cid=FEA59321F3A6B310&id=FEA59321F3A6B310%21132">código fuente</a> para que lo descarguen si desean mayor referencia.</div><div style="font-size: 100%; font-family: arial; "><br /></div><div style="font-size: 100%; font-family: arial; "><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuhwgMCXylMYl4tl7mesDvsxUxanh8C4SKjGQ7aPtQfHKvMKtToHe3EoCzhYoVHAEG47FG9KMQytsajvBwZ90XO3l3rRgqqB1EK7PUX7RK6YHX-ZqpInhhrJ7RkVUHKCYh4OBTVqadWLFE/s1600/thumbnail01.jpg" style="font-family: 'Times New Roman'; "><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuhwgMCXylMYl4tl7mesDvsxUxanh8C4SKjGQ7aPtQfHKvMKtToHe3EoCzhYoVHAEG47FG9KMQytsajvBwZ90XO3l3rRgqqB1EK7PUX7RK6YHX-ZqpInhhrJ7RkVUHKCYh4OBTVqadWLFE/s320/thumbnail01.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5728489451343847330" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 138px; " /></a><br class="Apple-interchange-newline"></div><div style="font-size: 100%; font-family: arial; "><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJiJGUSftTiucqx1DhbW-re2VLbHjZv9Xz4eUYHL0krC9Hns8MRifJMltR-NPwMLO7kPU5f93iNnQh44jY64096Y_biRxq4Lc2i-Qgf3xs82VWZWxcm3eQb1N2gUfH39_3RLbWPJ97DKF5/s1600/thumbnail02.jpg" style="font-family: 'Times New Roman'; "><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJiJGUSftTiucqx1DhbW-re2VLbHjZv9Xz4eUYHL0krC9Hns8MRifJMltR-NPwMLO7kPU5f93iNnQh44jY64096Y_biRxq4Lc2i-Qgf3xs82VWZWxcm3eQb1N2gUfH39_3RLbWPJ97DKF5/s320/thumbnail02.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5728489707210301346" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 314px; " /></a><br class="Apple-interchange-newline"></div><div style="font-size: 100%; font-family: arial; "><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBxghihKba0JHxcka7hPkouBtqMuSVi6BA6DceyA6a2vIpVBdfoZwxoaNzeZRFuWgf2UFXVGyzA2eRVXg64BsNvFWrZlfbJDWOyQwefjovaYy2_E7TlFUgNMHP4bYSpoph64wI5suEMRxY/s1600/thumbnail03.jpg" style="font-family: 'Times New Roman'; "><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBxghihKba0JHxcka7hPkouBtqMuSVi6BA6DceyA6a2vIpVBdfoZwxoaNzeZRFuWgf2UFXVGyzA2eRVXg64BsNvFWrZlfbJDWOyQwefjovaYy2_E7TlFUgNMHP4bYSpoph64wI5suEMRxY/s320/thumbnail03.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5728489877792827730" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 166px; " /></a><br class="Apple-interchange-newline"></div><div style="font-size: 100%; font-family: arial; ">Espero les sea útil y cualquier comentario o crítica es bien recibida.</div></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com0tag:blogger.com,1999:blog-2740526033515456638.post-72464399871068485932012-03-15T19:13:00.008-06:002012-03-15T21:24:04.403-06:00Poder sin Límites... o el sueño de cualquier nerd<div style="text-align: center;"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzdjeL43CdPgQ74HmREC6qfaZV8xxH5m7l3KZqleZ_ZKRKdeH4o87L1HVyTHHLbrB9I2QjD6Gij2RpBzYxxpWtGMhIAzgWagQ9FKJWxnPLTBnPLOA9IY2rJiSenMiE16mcz0hu-1aMZHuT/s400/Poder_sin_l%25C3%25ADmites.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5720316418861423378" style="font-size: 100%; font-family: Georgia, serif; display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 309px; height: 400px; " /></div><br /><span style="font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-style: normal; font-size: 100%; ">A pesar de que en México es casi nula su promoción, me tope en cartelera esta película y decidí ir a verla, recordando un </span><a href="http://youtu.be/-8jM2NxmXEs" style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; ">trailer</a><span style="font-style: normal; font-size: 100%; "> que vi hace un tiempo y un </span>vídeo<span style="font-style: normal; font-size: 100%; "> viral que </span>salio<span style="font-size: 100%; "> en las noticias de gente <a href="http://www.youtube.com/watch?v=dcDN409ZBv4" style="font-style: normal; ">volando en Nueva York</a>. La película esta grabada en el formato de falso documental así que si les gusto <i>Cloverfield </i>o <i>REC</i>, esta definitivamente les agradará.</span></span><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><span style="font-size: 100%;"><br /></span></span></div><div style="font-size: 100%; font-variant: normal; font-weight: normal; line-height: normal; "><span>Sin ganas de hacer spoiler, imagínense a tres chavos que un día se encuentran una extraña roca, al puro estilo <i>kriptonita</i>, que les otorga unos extraños poderes para mover cosas con la mente, volar y una gran fuerza. El sueño de cualquier nerd adolescente..., por que a poco no imaginaron defenderse de lo brabucones o impresionar a las chicas con tales poderes, por que yo si, aunque bueno... esa es otra historia.</span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-size: 100%; font-variant: normal; line-height: normal; "><span>El chiste de la película no es solo las demostraciones de los chavos y sus habilidades, si no tal como es la campaña del filme, ¿de que serían capaces?... como diría <i style="font-weight: normal; ">Ben Parker</i> "<b>con un gran poder viene una gran responsabilidad</b>". ¿Que harían si tuvieran una super fuerza, pudieran volar o movieran cosas con la mente?, ¿serían super heroes luchando por el bien y la justicia?... o ¿se dejarían llevar por el lado oscuro?.</span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 300px; height: 166px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtIME3GSxg3_7eKjeosx9NjDOXjY219XBbgi8wquXJqd-csz02oxTw87Qzb75S61_2-Dj1ClcVpWJCRHqb4XObqS3NxrLew0rJNR3-7bFw4DZJGIHSpT2IN2fkqAxORuPdsZoc8f3MwNDP/s400/chronicle.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5720323946744078338" /><span style="font-size: 100%; ">Pues la película presenta una muy buena historia, al principio muy clásica ("</span><i style="font-size: 100%; ">ah, eso ya lo he visto</i><span style="font-size: 100%; ">") pero que avanza captando la atención con sus acciones, después con su comportamiento y al final con un enfrentamiento entre los mas profundos instintos de los protagonistas.</span></span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span>Y el estilo de falso documental le da un sentido más "protagónico" por que te hacen sentir uno de ellos, siendo parte de las bromas, volando por los aires o incluso haciendo a un lado las "molestias". También agrada mucho el hecho de que no es solo una cámara la que cuenta la historia, si no varias que se van presentando durante la película, y aunque al final ya no sabes cuál es cuál la que esta tomando a quien, no se pierde la sensación de ser un protagónico más.</span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span>Realmente me busco la película, son de esas de las que sales de la sala tratando de hacer lo que viste, imaginándote salir volando o preguntándote las cosas que harías si tuvieras esos poderes. Lo genial que sería ser malo, o lo bien que te sentirías haciendo el bien.</span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span><br /></span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "><span>En fin, si no se marean fácilmente, es una buen película que disfrutarán; y aunque su duración es de casi 90 minutos, te deja con buen sabor de boca y preguntándote si habrá una 2da parte. Bueno, me adelanto contestándoles que al parecer sí, puesto que ha generado muchas ganancias alrededor del mundo por lo que la <b>FOX</b> ya esta preparando la secuela.</span></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><br /></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2lfeb_jl2CThfHI0LfDrOhPHTsva6JMJjWfPmFqAhpEE13snrkTwwzb0ZH6Zct96-ghpcKZL9IoTd0xSvwViX5dINsBfkVgAjUzKyUmGEVge4-NOhxKVEO-6bndVV5PtKmPrb5kkW7yNO/s1600/Poder_sin_limite_02.jpg"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2lfeb_jl2CThfHI0LfDrOhPHTsva6JMJjWfPmFqAhpEE13snrkTwwzb0ZH6Zct96-ghpcKZL9IoTd0xSvwViX5dINsBfkVgAjUzKyUmGEVge4-NOhxKVEO-6bndVV5PtKmPrb5kkW7yNO/s400/Poder_sin_limite_02.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5720329666923579250" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 284px; " /></a><br class="Apple-interchange-newline"></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com0tag:blogger.com,1999:blog-2740526033515456638.post-71858586594497909942012-03-12T19:12:00.007-06:002012-03-12T20:27:33.442-06:00Como cambiar el título de una página con Code Behind<span style="font-weight: normal; font-style: normal; "><span><span style="font-size: 100%; ">De regreso con algo extremadamente sencillo, pero que puede ser útil al manejar eventos en páginas <i>ASPX</i>. </span></span><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: 100%; ">A veces, en base a ciertas condiciones pueden cambiar aspectos, como colores, títulos, etc., y en este ejemplo, el título de la página.</span></span><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-size: 100%; "><br /></span></div><div style="font-size: 100%; font-variant: normal; line-height: normal; "><span><span style="font-weight: normal; font-style: normal; font-size: 100%; ">Lo que hacemos normalmente con los tags<b> </b></span><b style="font-weight: normal; font-style: normal; "><span style="background-color: rgb(238, 238, 238); font-size: 12px; text-align: -webkit-auto; "><title</span><span style="background-color: rgb(238, 238, 238); font-size: 12px; text-align: -webkit-auto; ">>Título</span><span style="background-color: rgb(238, 238, 238); font-size: 12px; text-align: -webkit-auto; "></title</span><span style="background-color: rgb(238, 238, 238); font-size: 12px; text-align: -webkit-auto; ">></span></b><span style="font-style: normal; font-weight: normal; font-size: 100%; ">en el Code Behind usando </span><span style="font-weight: normal; font-style: normal; font-size: 100%; "><b>C#</b></span><span style="font-size: 100%; "> es con<i style="font-weight: normal; font-style: normal; "> </i><b>Page.Title</b><i style="font-weight: normal; font-style: normal; ">:</i></span></span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-size: 100%; "><br /></span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; line-height: normal; "><span style="font-size: 100%; "><b><span >this.</span>Page.Title = <span>"Este es el nuevo título de la página"</span>;</b></span></div><div style="font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; "><span style="font-size: 100%; "><br /></span></div><div style="font-weight: normal; font-style: normal; "><span><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: 100%; ">Como se ve, la propiedad </span><span style="font-variant: normal; font-weight: normal; line-height: normal; font-size: 100%; "><i>Title</i></span><span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size: 100%; "> recibe una cadena de texto que aplicará como el título de la página. También se puede utilizar:</span></span></div><div style="font-weight: normal; font-style: normal; "><span><br /></span></div><div style="font-style: normal; "><span><b><span >this.</span>Header.Title = <span><span>"Hola</span>"</span>;</b></span></div><div style="font-weight: normal; font-style: normal; "><span><br /></span></div><div style="font-weight: normal; font-style: normal; "><span>Como ven, es muy fácil aplicar dicho cambio. Cabe mencionar que <i>Page</i> tiene muchas propiedades como <i>ErrorPage</i> (para obtener o establecer la página personalizada en caso de error) o <i>StyleSheetTheme</i> (para obtener o establecer el tema <i>CSS</i> de la página) entre otros que valdría la pena probar.</span></div><div style="font-weight: normal; font-style: normal; "><span><br /></span></div><div style="font-weight: normal; font-style: normal; "><span>Hasta el próximo post...</span></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com0tag:blogger.com,1999:blog-2740526033515456638.post-80391962430176051462010-09-15T16:45:00.000-05:002010-09-15T16:47:07.398-05:00BlindMaiden.com<div><span class="Apple-style-span" >Voy a replicar lo que encontre en la página de <a href="http://www.taringa.net/posts/offtopic/955478/Blindmaiden_com-mito-o-que-cosa__.html">Taringa </a>acerca de Blind Maiden, lo cual, si dejamos que la idea nos invada y por un momento imaginemos estar en esa situación, entonces si es de miedo...</span></div><div><span class="Apple-style-span" ><br /></span></div><div><span class="Apple-style-span" ><i>"Tal vez se trate solo de eso,de una nueva Leyenda Urbana,pero de no ser así, nos encontrariamos ante un suceso escalofriantemente desconcertante que nos llevaría, una vez más, a la terrible conclusión de que no existen límites ni fronteras para el horror. Un horror que se adapta camaleónicamente a los tiempos y se vale de todos sus eventos para manifestarse ante nosotros.</i></span></div><div><span class="Apple-style-span" ><i><br /></i></span></div><div><span class="Apple-style-span" ><i>Son muchos los que cuentan haber entrado en una página web llamada www.blindmaiden.com (blind maiden significa doncella ciega). Normalmente, si pretendes acceder a ella, por más que lo intentes, tu explorador no te lo permitirá y aparecera otras cosas ya que para hacerlo deberás cumplir tres condiciones. Encontrarte completamente solo, hacerlo exactamente en la medianoche de un dia sin luna y tener apagadas todas las luces de la casa. Entonces, solo entonces se te permitirá el acceso. Una vez dentro, enseguida tras un impactante viaje por las imágenes que ofrece, sin necesidad de que nadie te explique nada, comprenderás, como dice el slogan de presentación de la página, que estarás ante 'una experiencia real de horror absoluto'. Tendrás que emplear tus cincos sentidos y poner especial cuidado en no clicquear, ni por error, el botón de 'Aceptar' en participar activamente en la experiencia. Si asi lo hicieses seria tu fin y quedarias transformado en una imagen más del amplio archivo de incautos que, antes que tu, osaron, tal vez incrédulos, tal vez curiosos, a probar esta experiencia.</i></span></div><div><span class="Apple-style-span" ><i><br /></i></span></div><div><span class="Apple-style-span" ><i>Pero ¿que es lo que se supone que ocurre una vez que haces clic sobre aquel botón? . Para tu sorpresa y horror observarás en tu monitor como una siniestra silueta se pasea... por tu propia casa!!! Querrás despertar de lo que desearás que sea una pesadilla cuando veas como ese espectro se acerca y entra en la misma habitación en la que te encuentras... te verás en tu monitor a ti mismo, de espaldas... entonces sentirás su presencia detrás de ti... te girarás no pudiéndolo soportar más y... lo último que verás, antes de morir, será el rostro de la doncella ciega que, despiadadamente te arrancará los ojos..."</i></span></div><div><span class="Apple-style-span" ><br /></span></div><div><span class="Apple-style-span" >Obviamente, si hacemos un whois al dominio veremos que esta en venta (o eso decia), y la verdad no creo que sea verdad... solo una leyenda urbana más que podría estar basada en una de las tantas películas que hay hoy en día...</span></div><div><span class="Apple-style-span" ><br /></span></div><div><span class="Apple-style-span" >Aunque insisto, imaginarse estar en esa situación si da escalofríos...</span></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com2tag:blogger.com,1999:blog-2740526033515456638.post-80424603454591119012010-09-13T14:57:00.001-05:002010-09-13T14:58:48.983-05:00Filtrar y Ordenar un DataTable con un DataView<div><div><span class="Apple-style-span" style=" ;font-family:arial;">Los que usamos <b>DataTables </b>para llenar controles de .NET como <i>DataGrids, ComboBox, CheckBoxList</i>, etc., generalmente obtenemos los datos de una consulta <i>SQL</i>, y como bien saben, en ella podemos agregar filtros y ordenamiento de la información.</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">¿Pero que pasa en los casos en que el <b>DataTable </b>se llena manualmente o los datos son manipulados con código?, por ejemplo la traducción de los Nombres de los Productos. No siempre los filtros o el ordenamiento lo podemos hacer en el origen o mediante una consulta <i>SQL</i>.</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">Usando algunos de los métodos y propiedades de los <b>DataViews </b>de <i>System.Data</i> podemos lograr el objetivo, por ejemplo:</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;">//Llenamos un DataTable con la información requerida</span></span></div><div><span class="Apple-style-span" style="font-family:arial;">DataTable myDT = mifuncionLlenado();</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;">//Creamos un DataView com el DataTable</span></span></div><div><span class="Apple-style-span" style="font-family:arial;">DataView myDV = new DataView(myDT);</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;">/*Para ordenar los datos usamos la propiedad Sort del DataView con el campo o los campos con los que queremos hacerlo, muy parecido a SQL*/</span></span></div><div><span class="Apple-style-span" style="font-family:arial;">myDV.Sort = "nombreProducto ASC";</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;">/*Y para filtrarlo usamos la propiedad RowFilter*/</span></span></div><div><span class="Apple-style-span" style="font-family:arial;">myDV.RowFilter = "productoTipo = 1";</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#009900;"><br /></span></span></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;">//Establecidas las propiedades llenamos un Control con el DataView</span></span></div><div><span class="Apple-style-span" style="font-family:arial;">this.myDataGrid1.DataSource = myDV;</span></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="color:#006600;">/*Y todavia podemos llenar otro control con el mismo DataView pero con diferente filtro*/</span></span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;">myDV.RowFilter = "productoTipo = 2";</span></div><div><span class="Apple-style-span" style="font-family:arial;">this.myDataGrid.DataSource = myDV;</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">El <b>DataView </b>puede ser la vista de un <b>DataTable </b>al que se le puede aplicar filtros, ordenamiento, entre otras cosas, pero haciendolo en memoria.</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">Espero sea de ayuda y apoyo este artículo.</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">Happy Coding!!</span></div><div><span class="Apple-style-span" style="font-family:arial;"></span></div><div></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">Fuente: <i>http://msdn.microsoft.com/es-es/library/system.data.dataview(VS.80).aspx</i></span></div></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com0tag:blogger.com,1999:blog-2740526033515456638.post-11099789580283842312010-08-29T18:35:00.004-05:002010-08-29T18:51:10.105-05:00Transacciones en SQL Server 2005<div><span class="Apple-style-span" style="font-family:arial;">Después de un rato de no estar por aquí regreso con esta pequeña entrada que se me hace muy interesante y sobre todo útil. Las </span><i><span class="Apple-style-span" style="font-family:arial;">Transacciones </span></i><span class="Apple-style-span" style="font-family:arial;">sobre </span><b><span class="Apple-style-span" style="font-family:arial;">SQL Server</span></b><span class="Apple-style-span" style="font-family:arial;"> son de mucha ayuda al realizar consultas algo complejas que impliquen afectar de manera riesgosa la integridad de la tablas en la Base de Datos.</span></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">Todo lo que se incluya dentro de la sección de la </span><i><span class="Apple-style-span" style="font-family:arial;">Transacción </span></i><span class="Apple-style-span" style="font-family:arial;">se realizará, a menos que ocurra un problema, ya que si esto pasa, todo lo que se llevaba hecho hasta entonces regresará a su estado anterior... como si nunca hubiera pasado nada.</span></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">Y utilizando el Try... Catch SQL Server podran obtener cierta información el error ocurrido.</span></div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="color:#000099;">BEGIN TRY</span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="color:#000099;"><span class="Apple-style-span" style="font-family:'courier new';"></span></span></span><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="color:#000099;"> </span></span><span class="Apple-style-span" style="color:#000099;">BEGIN TRANSACTION</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-tab-span" style="white-space:pre"> </span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="color:#009900;">--Codigo riesgoso aqui. Lo que sigue es ejemplo</span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">declare @d decimal</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span><span class="Apple-style-span" style="font-family:'courier new';">set @d = (select 5 / 0)</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-tab-span" style="white-space:pre"> </span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="color:#000099;"> </span></span></span><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="color:#000099;">COMMIT TRANSACTION</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="color:#000099;">END TRY</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="color:#000099;">BEGIN CATCH</span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"></span></span><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-tab-span" style="white-space:pre"> </span>select <span class="Apple-style-span" style="color:#FF0000;">'Lo sentimos ocurrio un Error. Revise los siguientes </span><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="color:#FF0000;"> </span></span><span class="Apple-style-span" style="color:#FF0000;">datos para mas información.</span>' as Mensaje, <span class="Apple-style-span" style="color:#CC66CC;">error_number()</span> AS <span class="Apple-tab-span" style="white-space:pre"> </span>Numero_de_Error, </span><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="color:#CC66CC;">error_severity()</span> AS Gravedad_del_Error, <span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-style-span" style="color:#CC66CC;">error_state()</span> AS Estado_del_Error, <span class="Apple-style-span" style="color:#CC66CC;">error_procedure()</span> AS <span class="Apple-tab-span" style="white-space:pre"> </span>Procedimiento_del_Error, </span><span class="Apple-style-span" style="font-family: 'courier new'; "><span class="Apple-style-span" style="color:#CC66CC;">error_line()</span> AS Linea_de_Error, <span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-style-span" style="color:#CC66CC;">error_message()</span> AS Mensaje_de_Error;</span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"> </span></span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="font-family:'courier new';"></span></span><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="color:#000099;"> </span></span><span class="Apple-style-span" style="color:#000099;">ROLLBACK TRANSACTION</span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><span class="Apple-style-span" style="color:#000099;">END CATCH</span></span></div><div><br /></div><div><span class="Apple-style-span" style="font-family:arial;">Como conclusión, el uso de las <i>Transacciones </i>protege los datos de la Base de Datos ante un error ocurrido durante la ejecución de las <i>querys</i>. De esa manera, se pueden ejecutar con mucho mas confianza.</span></div><div><span class="Apple-style-span" style="font-family:arial;"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;">Happy Coding!!</span></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com4tag:blogger.com,1999:blog-2740526033515456638.post-11282593926141884632008-11-27T09:52:00.023-06:002008-11-27T11:01:22.847-06:00Como crear Reportes Dinámicos con Crystal Reports y C# en WebForms usando DataSets y DataTables<div style="text-align: justify;"><span style="font-family: arial;font-family:arial;" >Hace tiempo me tope con la necesidad de generar reportes en </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >ASP.NET</span><span style="font-family: arial;font-family:arial;" > e imprimirlos. Investigando un poco, me tope con el detalle que no es tan fácil realizarlo como sería en un ambiente de escritorio. De hecho, se complicaba un poco más ya que debía de utilizar </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >DataSets</span> dinámicos, es decir, generados durante el uso de la aplicación, no desde un principio.<br /><br /><span style="font-family: arial;font-family:arial;" >Decidí utilizar </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >Crystal Reports</span><span style="font-family: arial;font-family:arial;" >, ya que se encuentra implementado dentro de </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >Visual Studio</span> <span style="font-weight: bold; font-family: arial;font-family:arial;" >2005</span><span style="font-family: arial;font-family:arial;" >, incluyendo opciones como exportación a diferentes formatos como </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >Excel</span><span style="font-family: arial;font-family:arial;" > y </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >PDF</span><span style="font-family: arial;font-family:arial;" >.</span> <br /><br /><span style="font-family: arial;font-family:arial;" >Investigando un poco, me encontré con un código proporcionado por </span><a style="font-weight: bold; font-family: arial;" href="http://www.mygnet.net/codigos/vbdotnet/net/crystal_reports_con_datos_dinamicos.1474">Fernando Berenguer Doménech</a><span style="font-family: arial;font-family:arial;" > en el cuál explicaba el método para realizarlo. Basándome en este gran apoyo, pude dar con la solución que a continuación expongo:</span><br /><br /><span style="font-family: arial;font-family:arial;" >Principalmente agregó al proyecto un reporte </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >Crystal Reports</span><span style="font-family: arial;font-family:arial;" > desde el </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >Explorador de Soluciones</span><span style="font-family: arial;font-family:arial;" >. Yo le deje el nombre de </span><span style="font-weight: bold; font-family: arial;font-family:arial;" >CrystalReport.rpt</span><br /></div><div style="font-family: arial; text-align: justify;font-family:arial;"><br />Más adelante le daremos formato al reporte. Por mientras lo dejaremos tal cuál como se agrego. Posteriormente insertamos a nuestro formulario un <span style="font-weight: bold;">CrystalReportViewer</span>, al cuál yo le puse de nombre <span style="font-weight: bold;">crv1</span>; este control será por el cuál mostraremos nuestro reporte o archivo <span style="font-weight: bold;">.rpt</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZqB_z_AUc4HykxeHzMCrZLwhT3eL_WXVjLSINHLvZ9k-fhDfNBf9mTYtP3GBTxHJFUZdGkM5FtXhc9tV3aTYCc3_yt0ko5R-nQqoW_Tks1Fmwb0-8Ure_UJcP-DPSV_PSl_EO7H7Ytp5C/s1600-h/screen1.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 268px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZqB_z_AUc4HykxeHzMCrZLwhT3eL_WXVjLSINHLvZ9k-fhDfNBf9mTYtP3GBTxHJFUZdGkM5FtXhc9tV3aTYCc3_yt0ko5R-nQqoW_Tks1Fmwb0-8Ure_UJcP-DPSV_PSl_EO7H7Ytp5C/s400/screen1.JPG" alt="" id="BLOGGER_PHOTO_ID_5273379086098626018" border="0" /></a><br />Es importante mencionar que ya contamos con el <span style="font-weight: bold;">DataSet</span> que queremos imprimir. Recordando que dentro de este contamos con diferentes <span style="font-weight: bold;">DataTables</span> identificados por un índice o nombre.<br /><br /><span style="font-weight: bold; color: rgb(0, 0, 153);">public static DataSet ds1 = new DataSet();</span><br /><br />Durante el desarrollo de la aplicación lleno mi <span style="font-weight: bold;">DataSet</span> con una consulta <span style="font-weight: bold;">SQL</span>.<br /><br />Ahora veremos el código que utilicé para enviar a imprimir un <span style="font-weight: bold;">DataSet</span><w:view></w:view><w:trackmoves><w:trackformatting><w:punctuationkerning><w:validateagainstschemas><w:donotpromoteqf> <w:compatibility> <w:breakwrappedtables> <w:snaptogridincell> <w:wraptextwithpunct> <w:useasianbreakrules> <w:dontgrowautofit> <w:splitpgbreakandparamark> <w:dontvertaligncellwithsp> <w:dontbreakconstrainedforcedtables> <w:dontvertalignintxbx> <w:word11kerningpairs> <w:cachedcolbalance> </w:cachedcolbalance> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:narylim></m:intlim> </m:wrapindent><!--[endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; mso-themecolor:hyperlink; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {mso-style-noshow:yes; mso-style-priority:99; color:purple; mso-themecolor:followedhyperlink; text-decoration:underline; text-underline:single;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:612.0pt 792.0pt; margin:70.85pt 3.0cm 70.85pt 3.0cm; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tabla normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} </style> <![endif]--> generado dinámico.<br /><br /><span style="font-weight: bold; color: rgb(0, 153, 0);">/*Yo lo puse dentro del evento Page_Load*/</span><br /><span style="font-weight: bold; color: rgb(255, 0, 0);">protected void Page_Load(object sender, EventArgs e)</span><br /><span style="font-weight: bold; color: rgb(255, 0, 0);">{</span><span style="font-weight: bold;"><br /><span style="color: rgb(0, 102, 0);">/*Construimos un DataSet y un DataTable para ser enviados como origen de datos a Crystal Reports. El DataTable lo indentificaremos con un nombre especifico*/</span></span><span style="font-weight: bold;"><br /><span style="color: rgb(0, 0, 153);">DataSet myDS = new DataSet();</span></span><span style="font-weight: bold; color: rgb(0, 0, 153);"><br />DataTable myDT = new DataTable("dataset");</span><span style="font-weight: bold;"><br /><br /><span style="color: rgb(0, 102, 0);">/*Mezclamos el DataTable que acabamos de crear con el DataTable que proviene de nuestro DataSet donde esta el resultado de una consulta SQL. Para esto utilizamos el método Merge*/</span></span><span style="font-weight: bold;"><br /><br /></span><span style="font-weight: bold;"><span style="color: rgb(0, 0, 153);">myDT.Merge(ds1.Tables[0]);</span></span><span style="font-weight: bold;"><br /><br /><span style="color: rgb(0, 102, 0);">/*Agregamos el nuevo DataTable al DataSet que será el origen de datos de Crystal Reports</span></span><span style="color: rgb(0, 102, 0);">*/</span><span style="font-weight: bold;"><br /><span style="color: rgb(0, 0, 153);">myDS.Tables.Add(myDT);</span></span><span style="font-weight: bold;"><br /><br /></span><span style="font-weight: bold;"><span style="color: rgb(0, 102, 0);">/*Ahora creamos un archivo XML que contendrá nuestro DataSet. En teoría, este será escrito temporalmente en este archivo, que a su vez se convertirá en el origen de datos en el Reporte de Crystal Reports. Cabe mencionar que es muy importante que se tengan los permisos necesarios en la carpeta*/</span></span><span style="font-weight: bold;"><br /></span><span style="font-weight: bold;"><span style="color: rgb(0, 0, 153);">myDS.WriteXml(@"C:\Inetpub\wwwroot\proyecto\xml\report.xml");</span></span><span style="font-weight: bold;"><br /><br /><span style="color: rgb(0, 102, 0);">/*Ahora cargamos el archivo .rpt De igual manera hay que considerar los permisos necesarios*/</span></span><span style="font-weight: bold;"><br /><span style="color: rgb(0, 0, 153);">CrystalDecisions.CrystalReports.Engine.ReportDocument myrpt;</span></span><span style="font-weight: bold; color: rgb(0, 0, 153);"><br />myrpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();</span> <span style="font-weight: bold; color: rgb(0, 0, 153);"><br />myrpt.Load(@"C:\Inetpub\wwwroot\proyecto\rpts\CrystalReport.rpt");</span><span style="font-weight: bold;"><br /><br /><span style="color: rgb(0, 102, 0);">/*Establecemos como Origen de Datos el DataSet que llenamos */</span></span> <span style="font-weight: bold;"><br /><span style="color: rgb(0, 0, 153);">myrpt.Database.Tables["preview"].SetDataSource(myDS);</span></span><span style="font-weight: bold;"><br /><br /></span><span style="font-weight: bold;"><span style="color: rgb(0, 102, 0);">/*Llenamos el CrystalReportViewer con la información*/</span></span><span style="font-weight: bold;"><br /></span><span style="font-weight: bold;"><span style="color: rgb(0, 0, 153);">crv1.ReportSource = myrpt;</span></span> <span style="font-weight: bold; color: rgb(0, 0, 153);"> crv1.DataBind();</span><br /><span style="font-weight: bold; color: rgb(255, 0, 0);">}</span><br /><br />Ahora… aun no funciona como debería ser. Es turno de trabajar con el reporte <span style="font-weight: bold;">CrystalReport.rpt</span> y prepararlo para que muestre la información como debería de ser. En este archivo tendremos que configurar en el <span style="font-weight: bold;">Explorador de Campos</span> el origen con un<span style="font-weight: bold;"> DataSet</span> creado en un archivo<span style="font-weight: bold;"> xml.</span><br /><br />Aquí es muy importante considerar que en el <span style="font-weight: bold;">DataSet</span>, el <span style="font-weight: bold;">DataTable</span> y los campos deben de llamarse igual que a los del resultado de la consulta <span style="font-weight: bold;">SQL</span>. A continuación creamos el archivo <span style="font-weight: bold;">report.xml</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOJVcs8IlBXHZlLxyFggwLMxs1_Mj6Pqh8p5d9Ov9jIdyExFdci_Lh46OaI2CplaX2xkMP7pp2uW1VxaXG4MXbAV3LeesKS-GY2BekJbpxSwZrNvKV_-n7NBOb1tXsnoR6-TeJJjsRAzQ/s1600-h/screen6.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 377px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOOJVcs8IlBXHZlLxyFggwLMxs1_Mj6Pqh8p5d9Ov9jIdyExFdci_Lh46OaI2CplaX2xkMP7pp2uW1VxaXG4MXbAV3LeesKS-GY2BekJbpxSwZrNvKV_-n7NBOb1tXsnoR6-TeJJjsRAzQ/s400/screen6.jpg" alt="" id="BLOGGER_PHOTO_ID_5273379261992782210" border="0" /></a><br /><newdataset></newdataset><newdataset><preview><contacto></contacto></preview></newdataset><newdataset><preview><nombrecandidato></nombrecandidato></preview></newdataset><newdataset><preview><expediente></expediente></preview></newdataset><newdataset><preview><afiliacion></afiliacion></preview></newdataset><newdataset><preview><f_nac></f_nac></preview></newdataset><newdataset><preview></preview></newdataset><newdataset></newdataset>Nótese el nombre del campo después de “<span style="font-weight: bold;">NewDataSet</span>”, ”<span style="font-weight: bold;">preview</span>” es como se llama nuestro <span style="font-weight: bold;">DataTable</span>.<br /><br />Una vez tengamos creada esta “<span style="font-weight: bold;">Base de Datos Temporal</span>”, nos ubicaremos en el <span style="font-weight: bold;">CrystalReport.rpt</span> y utilizaremos el <span style="font-weight: bold;">Explorador de Campos</span> para dar de alta nuestro <span style="font-weight: bold;">DataSet</span> del <span style="font-weight: bold;">XML</span>.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiitw2nRejuhzpxFZp_5cJ7vPZOw12aUjNQ44cekFa33VLgJLeF1kh04pL_T3yrRp5JV_ZVI8vQg5pLUnjKnE0jbt1Kp0HRKJdFgk9ridqFbf9VO7i-ORghLRnhsllrdVr59ZPAuInUlRoO/s1600-h/screen2.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 204px; height: 141px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiitw2nRejuhzpxFZp_5cJ7vPZOw12aUjNQ44cekFa33VLgJLeF1kh04pL_T3yrRp5JV_ZVI8vQg5pLUnjKnE0jbt1Kp0HRKJdFgk9ridqFbf9VO7i-ORghLRnhsllrdVr59ZPAuInUlRoO/s400/screen2.JPG" alt="" id="BLOGGER_PHOTO_ID_5273379454013002386" border="0" /></a><br />Sobre la opción <span style="font-weight: bold;">Campos de Base de Datos</span>, daremos clic derecho y elegiremos A<span style="font-weight: bold;">sistente de Base de Datos</span>. En la ventana nueva, abriremos la carpeta <span style="font-weight: bold;">Datos del Proyecto y Objetos .NET</span>; será entonces donde podremos elegir en <span style="font-weight: bold;">Ruta del Archivo</span> el <span style="font-weight: bold;">XML</span> que creamos anteriormente.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHGaZB-8lBddQjr-lt9zk3cQ9cBITKrbxLcb2A-rnYinLGmyF0TwzZSB3VEZ60Nl3z5VVliWiWgNiGOvM2c6IdUgEx-94w-vvBpK0V2zOZLelW1KMFX510N4vuvzttwA8sIVly_j7GWm8S/s1600-h/screen3.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 255px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHGaZB-8lBddQjr-lt9zk3cQ9cBITKrbxLcb2A-rnYinLGmyF0TwzZSB3VEZ60Nl3z5VVliWiWgNiGOvM2c6IdUgEx-94w-vvBpK0V2zOZLelW1KMFX510N4vuvzttwA8sIVly_j7GWm8S/s400/screen3.JPG" alt="" id="BLOGGER_PHOTO_ID_5273379604470156578" border="0" /></a><br />Ya que tengamos cargado el <span style="font-weight: bold;">DataSet</span>, lo pasaremos por completo a la lista de T<span style="font-weight: bold;">ablas Seleccionadas</span>. De esta manera habremos determinado como <span style="font-weight: bold;">Origen de Datos</span> nuestro <span style="font-weight: bold;">DataSet</span>, con un <span style="font-weight: bold;">DataTable</span> llamado “<span style="font-weight: bold;">preview</span>” y con sus campos; los cuáles podremos pasar manualmente a nuestro <span style="font-weight: bold;">CrystalReport .rpt</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZJ3_RaNn3S6qO6KJ_TTdCkjhLZrdBa7y_rf4n9UrditQOD1XwaJdB0iPYTtiisNw_C-3_3YlDeEO8UuRLKjS6-u02yR8EBZrD8Jv6E3nteH_2lGNxM9qecfVO62wXHDrlhZkyxTCjCMLO/s1600-h/screen4.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 358px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZJ3_RaNn3S6qO6KJ_TTdCkjhLZrdBa7y_rf4n9UrditQOD1XwaJdB0iPYTtiisNw_C-3_3YlDeEO8UuRLKjS6-u02yR8EBZrD8Jv6E3nteH_2lGNxM9qecfVO62wXHDrlhZkyxTCjCMLO/s400/screen4.jpg" alt="" id="BLOGGER_PHOTO_ID_5273379780453830082" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXk8Rq5U-tqLYu-_wjgKvkhkndNyOrBo3YAJjcMKtjizD0bsHC41h5qkqr_cMQB-S1eQvxtQvAn52LTJJMtURcPvg0VhObI0U4HXWwTwTqiMSarhuPboxgznT0hQBSU06ai6GZiCFUlQnh/s1600-h/screen5.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 204px; height: 241px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXk8Rq5U-tqLYu-_wjgKvkhkndNyOrBo3YAJjcMKtjizD0bsHC41h5qkqr_cMQB-S1eQvxtQvAn52LTJJMtURcPvg0VhObI0U4HXWwTwTqiMSarhuPboxgznT0hQBSU06ai6GZiCFUlQnh/s400/screen5.jpg" alt="" id="BLOGGER_PHOTO_ID_5273379778609918802" border="0" /></a><br />A estos campos podremos darle el formato que deseemos, la ubicación en el reporte, etc. Si todo salió bien, al momento en que probamos nuestra aplicación, el <span style="font-weight: bold;">DataSet</span> en el <span style="font-weight: bold;">XML</span> será llenado y el reporte lo podrá visualizar desglosando el listado de registros.<br /><br />Cualquier duda ya saben donde encontrarme.</m:defjc></m:rmargin></m:lmargin></m:dispdef></m:smallfrac></m:brkbinsub></m:brkbin></m:mathfont></m:mathpr></w:word11kerningpairs></w:dontvertalignintxbx></w:dontbreakconstrainedforcedtables></w:dontvertaligncellwithsp></w:splitpgbreakandparamark></w:dontgrowautofit></w:useasianbreakrules></w:wraptextwithpunct></w:snaptogridincell></w:breakwrappedtables></w:compatibility></w:donotpromoteqf></w:validateagainstschemas></w:punctuationkerning></w:trackformatting></w:trackmoves></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com4tag:blogger.com,1999:blog-2740526033515456638.post-52482195081527942092008-10-20T15:35:00.004-05:002008-10-20T15:48:00.273-05:00PHP y Postgres<span style="font-family:arial;"></span><span style="font-family:arial;">Es relativamente fácil utilizar la base de datos <span style="font-weight: bold;">Postgres</span> en <span style="font-weight: bold;">PHP</span>. Si anteriormente habías conectado <span style="font-weight: bold;">PHP</span> con <span style="font-weight: bold;">MySQL</span>, es practicamente lo mismo.</span><br /><br /><span style="font-family:arial;">1.- Modificamos el <span style="font-weight: bold;">PHP.ini</span> para agregar la extensión de <span style="font-weight: bold;">pgsql</span>. En ambiente <span style="font-weight: bold;">Windows</span> basta con teclear en menú ejecutar <span style="font-weight: bold;">php.ini</span> para abrirlo y modificarlo. En linux deberas de localizarlo en la carpeta de <span style="font-weight: bold;">Apache</span>.</span><br /><br /><span style="font-family:arial;">2.- Dentro de este archivo, en el caso de windows bastara con descomentar la siguiente línea:</span><br /><br /><div style="text-align: center;"><span style="font-weight: bold;font-family:arial;" >extension=php_pgsql.dll</span><br /></div><br /><span style="font-family:arial;">3.- En ambiente Linux son varias líneas que se pueden descomentar y modificar; cada una de ellas tiene comentado su descripción, por ejemplo:</span><br /><br /><span style="font-weight: bold;font-family:arial;" >pgsql.allow_persistent = On</span><br /><span style="font-weight: bold;font-family:arial;" >pgsql.auto_reset_persistent = Off</span><br /><span style="font-weight: bold;font-family:arial;" >pgsql.max_persistent = -1</span><br /><span style="font-weight: bold;font-family:arial;" >pgsql.max_links = -1</span><br /><span style="font-weight: bold;font-family:arial;" >pgsql.ignore_notice = 0</span><br /><span style="font-weight: bold;font-family:arial;" >pgsql.log_notice = 0</span><br /><br /><span style="font-family:arial;">4- Todo esto con el fin de preparar la conexión. Es importante reiniciar el servidor <span style="font-weight: bold;">Apache</span> una vez guardados los campos.</span><br /><br /><span style="font-family:arial;">5.- Para establecer una conexión <span style="font-weight: bold;">PHP - Postgres</span>, crearemos un archivo al que llamaremos <span style="font-weight: bold;">conec.php</span> e incluiremos las siguientes lineas:</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Utilizamos una función para establecer la conexión*/</span><br /><span style="font-weight: bold;font-family:arial;" >function Conectarse()</span><br /><span style="font-weight: bold;font-family:arial;" >{</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Mediante una condicion determinamos si se establecio o no la conexion.</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >Usamoa la pg_connect donde colocamos los parámetros:</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >dbname=Nombre de la Base de Datos</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >port=Puerto de Conexion a la Base de Datos</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >user=Nombre de Usuario para conectarse</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >password=Password para conectarse</span><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >*/</span><br /><span style="font-weight: bold;font-family:arial;" >if (!($conexion = pg_connect("dbname=gyc port=5432 user=usuario password=password")))</span><br /><span style="font-weight: bold;font-family:arial;" >{</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Si la conexion no es exitosa se mostrara el siguiente mensaje y salimos*/</span><br /><span style="font-weight: bold;font-family:arial;" >echo "No pudo conectarse al servidor";</span><br /><span style="font-weight: bold;font-family:arial;" >exit();</span><br /><span style="font-weight: bold;font-family:arial;" >}</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*No importa si se establecio o no la conexion, esta sera devuelta por la funcion*/</span><br /><span style="font-weight: bold;font-family:arial;" >return $conexion;</span><br /><span style="font-weight: bold;font-family:arial;" >}</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Ahora mandamos a llamar la funcion*/</span><br /><span style="font-weight: bold;font-family:arial;" >Conectarse();</span><br /><br /><span style="font-family:arial;">6.- Este archivo lo podemos guardar en alguna parte de nuestro proyecto y usar su ruta absoluta, pero en el caso de este ejemplo, lo colocaremos en la misma carpeta donde estara el archivo en donde usaremos la Base de Datos. Este archivo se llamara <span style="font-weight: bold; font-style: italic;">ejemplosql.php</span></span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCnQCkyqqNv_b6KYBnXdpYBoGSYl-33SEp_bSMo6pdJ0dUd_dfOSGy5XwJ0giEPG66kcMBad7OZLJjQA3z8YOOVurH6eE6LBua7cW9WPyuh5nctaQE13YBrAmJxP97LYeQlItgQ8-6alpS/s1600-h/mapa.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCnQCkyqqNv_b6KYBnXdpYBoGSYl-33SEp_bSMo6pdJ0dUd_dfOSGy5XwJ0giEPG66kcMBad7OZLJjQA3z8YOOVurH6eE6LBua7cW9WPyuh5nctaQE13YBrAmJxP97LYeQlItgQ8-6alpS/s200/mapa.JPG" alt="" id="BLOGGER_PHOTO_ID_5259340430454103698" border="0" /></a><br /><br /><br /><span style="font-family:arial;">7.- En <span style="font-weight: bold;">ejemplosql.php</span> incluiremos el siguiente código:</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Incluimos el archivo de conexión*/</span><br /><span style="font-weight: bold;font-family:arial;" >include("conec.php");</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Guardamos en una variable el valor retornado de la función de conexión*/</span><br /><span style="font-weight: bold;font-family:arial;" >$con=Conectarse();</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Guardamos en una variable la sentencia SQL, en este caso del tipo SELECT*/</span><br /><span style="font-weight: bold;font-family:arial;" >$sql_select_1 = "select nombre, edad from alumnos where id_alumno = '10'";</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Realizamos la conexión y ejecutamos la consulta SQL mediante la función</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >pg_Exec con los parámetros de conexión a la Base de Datos ($con) y la sentencia SQL ($sql_select_1)*/</span><br /><span style="font-weight: bold;font-family:arial;" >$query_select_1 = pg_Exec($con, $sql_select_1);</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Si todo salio bien, obtendremos un objeto con los datos obtenidos de la consulta SQL,</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >mediante la funcion pg_fetch_object. Solo para los casos de SELECT*/</span><br /><span style="font-weight: bold;font-family:arial;" >$query_result_1 = pg_fetch_object($query_equipos);</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Una vez obtenido los datos, los podemos todavia extraer de forma mas particular,</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >mediante los nombres de los campos y guardandolos en variables*/</span><br /><span style="font-weight: bold;font-family:arial;" >$nombre = $query_result_1->nombre;</span><br /><span style="font-weight: bold;font-family:arial;" >$edad =$query_result_1->edad;</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Imprimos las variables, comprobando el resultado.*/</span><br /><span style="font-weight: bold;font-family:arial;" >echo "El nombre es: ".$nombre;</span><br /><span style="font-weight: bold;font-family:arial;" >echo "Y su edad es: $edad años";</span><br /><br /><span style="font-family:arial;">8.- Hasta este punto, hemos logrado realizar una conexión <span style="font-weight: bold;">PHP - Postgres</span>. Si obtuvimos algun error, podremos buscarlo por medio del numero de línea, así mismo si el error esta en la sentencia <span style="font-weight: bold;">SQL</span>.</span><br /><br /><span style="font-family:arial;">9.- La clase de sentencia <span style="font-weight: bold;">SELECT</span> que utilizamos es para obtener datos específicos en una sola fila. Si deseamos recuperar información en un resultado <span style="font-weight: bold;">SELECT</span> de mas de una línea: </span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Incluimos el archivo de conexión*/</span><br /><span style="font-weight: bold;font-family:arial;" >include("conec.php");</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Guardamos en una variable el valor retornado de la función de conexión*/</span><br /><span style="font-weight: bold;font-family:arial;" >$con=Conectarse();</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Guardamos en una variable la sentencia SQL, en este caso del tipo SELECT*/</span><br /><span style="font-weight: bold;font-family:arial;" >$sql_select_2 = "select nombre, edad, grado from alumnos where edad < '18'";</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Realizamos la conexión y ejecutamos la consulta SQL mediante la función</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >pg_Exec con los parámetros de conexión a la Base de Datos ($con) y la sentencia SQL ($sql_select_2)*/</span><br /><span style="font-weight: bold;font-family:arial;" >$query_select_2 = pg_Exec($con, $sql_select_2);</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Obtenemos el número de filas del resultado con la función pg_num_rows*/</span><br /><span style="font-weight: bold;font-family:arial;" >$no_filas = pg_num_rows($query_select_2);</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Mediante un ciclo for, leemos cada una de las filas*/</span><br /><span style="font-weight: bold;font-family:arial;" >for ($i=0;$i<$no_filas;$i++)</span><br /><span style="font-weight: bold;font-family:arial;" >{</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Guardamos en un vector cada una de las filas durante el ciclo con la función</span><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >pg_fetch_array con los parametros del objecto SQL y el numero de fila durante el ciclo*/</span><br /><span style="font-weight: bold;font-family:arial;" >$array_local = pg_fetch_array($query_ausencias_local,$i);</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Creado el vector, y durante el ciclo, podemos leer cada una de las filas mediante sus posiciones*/</span><br /><span style="font-weight: bold;font-family:arial;" >echo "Su nombre es: $array_local[0], tiene $array_local[1] años y esta en el $array_local[2] grado";</span><br /><span style="font-weight: bold;font-family:arial;" >}</span><br /><br /><span style="font-family:arial;">10.- Para el caso de sentencias <span style="font-weight: bold;">SQL</span> como <span style="font-weight: bold; font-style: italic;">update, delete e insert</span>, se utiliza como se muestra a continuacion:</span><br /><br /><span style="font-weight: bold;font-family:arial;" >$sql_update = "update alumnos set nombre = 'Mauricio', edad = '24', grado = '8'";</span><br /><span style="font-weight: bold;font-family:arial;" >pg_Exec($con, $sql_update);</span>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com0tag:blogger.com,1999:blog-2740526033515456638.post-20849252552028210002008-09-18T08:52:00.005-05:002008-09-18T09:43:57.442-05:00Windows vs Linux en 3 Rounds<div style="text-align: center;"><span style="font-family: arial; font-weight: bold;">Round 1</span><br /></div><div style="text-align: center;"><a style="font-family: arial; font-weight: bold;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJlhhWHlUmo21hBEE_lgNB6ocHytLUpZ6l-UrypgaaroLD9E-qBYh3ux3Egv7a30HlApXUlIZbWfmsuZfz9BGM5K1Ng2eolTSkuwBFWcUyTfVyzJ7eXLrs2lk9fI5SzBmEkQYTzGChHPPN/s1600-h/chiste-011.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJlhhWHlUmo21hBEE_lgNB6ocHytLUpZ6l-UrypgaaroLD9E-qBYh3ux3Egv7a30HlApXUlIZbWfmsuZfz9BGM5K1Ng2eolTSkuwBFWcUyTfVyzJ7eXLrs2lk9fI5SzBmEkQYTzGChHPPN/s320/chiste-011.jpg" alt="" id="BLOGGER_PHOTO_ID_5247371423472140642" border="0" /></a><span style="font-family: arial; font-weight: bold;">Round 2</span><br /></div><br /><a style="font-family: arial; font-weight: bold;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFl8tmxd9-DhROqs84g3AkvbpZgYndertl9_xtxTvIqHj6b3Anol78jYOxxSvlxiYwL18KQHyX24p6kgPCNtsIw-Khq4pee4lazuJhTC3xk_W_uvELFaQtLeWh563RvpfcQwzpGfxFY8ez/s1600-h/chiste-02-final.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFl8tmxd9-DhROqs84g3AkvbpZgYndertl9_xtxTvIqHj6b3Anol78jYOxxSvlxiYwL18KQHyX24p6kgPCNtsIw-Khq4pee4lazuJhTC3xk_W_uvELFaQtLeWh563RvpfcQwzpGfxFY8ez/s320/chiste-02-final.jpg" alt="" id="BLOGGER_PHOTO_ID_5247371517207294514" border="0" /></a><object style="font-family: arial; font-weight: bold;" height="302" width="400"><param name="allowfullscreen" value="true"> <param name="allowscriptaccess" value="always"> <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1721340&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1"> <embed src="http://vimeo.com/moogaloop.swf?clip_id=1721340&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="302" width="400"></embed></object><div style="text-align: center;"><span style="font-family: arial; font-weight: bold;">Round 3</span><br /></div><br /><a style="font-family: arial; font-weight: bold;" href="http://vimeo.com/1721340?pg=embed&sec=1721340">Linux vs Windows - Round 3 | Linux Adictos</a><span style="font-family: arial; font-weight: bold;"> from </span><a style="font-family: arial; font-weight: bold;" href="http://vimeo.com/user450861?pg=embed&sec=1721340">Esty</a><span style="font-family: arial; font-weight: bold;"> on </span><a style="font-family: arial; font-weight: bold;" href="http://vimeo.com/?pg=embed&sec=1721340">Vimeo</a><span style="font-family: arial; font-weight: bold;">.</span><br /><br /><span style="font-family: arial;">Como será el siguiente...?<br /><br />Fuente: http://www.vivalinux.com.ar/articulos/mortal-kombat-linux-vs-windows.html<br /></span>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com6tag:blogger.com,1999:blog-2740526033515456638.post-3496707508020116892008-09-11T10:41:00.010-05:002008-09-11T11:16:13.675-05:00Las Chicas de mis sueños... chicas Geek<span style="font-family:arial;">Anteriormente habia platicado de lo genial que sería tener una </span><a style="font-family: arial;" href="http://mauriciomoo.blogspot.com/2007/10/la-chica-de-mis-sueosuna-chica-geek.html">novia Geek</a><span style="font-family:arial;">, sin embargo nunca imagine que hubiera tantas, por lo que el sueño se puede hacer realidad (que cursi!!!). Me encuentro con una lista de chavas Geek, conocedoras de Linux, incluso muchas de ellas desarrolladoras, con amplios conocimientos en aspectos tecnológico... y sobre todo muy guapas.</span><br /><br /><strong style="font-family: arial;">Celeste Lyn Paul</strong><span style="font-family:arial;">: Diseñadora de interacción, investigadora y contribuidora del desarrollo de open source. También lidera el KDE Usability Project, mentor de OpenUsability Season of Usability y está involucrada en el desarrollo de Kubuntu. (Ya tiene novio T_T)</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNJiLwyy0aKV88rD06400mpXoRttuU_wxzUVYXH_FvShY_v4LE09-WuuRoQyDM-0ZOdwnhdAAp9gtNBcXZLf9tnd14ZDcz0b0LkbSD29MhlDIXrXHCWLxyfAOmZCaQnyvVo-0NcM34h9Pl/s1600-h/Celeste+Lyn+Paul.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNJiLwyy0aKV88rD06400mpXoRttuU_wxzUVYXH_FvShY_v4LE09-WuuRoQyDM-0ZOdwnhdAAp9gtNBcXZLf9tnd14ZDcz0b0LkbSD29MhlDIXrXHCWLxyfAOmZCaQnyvVo-0NcM34h9Pl/s320/Celeste+Lyn+Paul.jpg" alt="" id="BLOGGER_PHOTO_ID_5244795206260615762" border="0" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjug5fKLoff5ZMg7nGJBuC9scYCz54d3eMNCxytGefqmcx0_DPPAT-jRP4Di9EU4UzqFx4MicBMR7tR6uYn0sdbL5IALcOLLKj3oCKc_GpVmKZSJOqQutdw86b4p9lwkGyT9LyhDb7sCrA/s1600-h/Celeste+Lyn+Paul2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjug5fKLoff5ZMg7nGJBuC9scYCz54d3eMNCxytGefqmcx0_DPPAT-jRP4Di9EU4UzqFx4MicBMR7tR6uYn0sdbL5IALcOLLKj3oCKc_GpVmKZSJOqQutdw86b4p9lwkGyT9LyhDb7sCrA/s320/Celeste+Lyn+Paul2.jpg" alt="" id="BLOGGER_PHOTO_ID_5244795417959066434" border="0" /></a><br /><br /><strong style="font-family: arial;">Erinn Clark</strong><span style="font-family:arial;">: Una desarrolladora de Debian que también fue co-fundadora y lidera actualmente el proyecto Debian Women. Un proyecto muy interesante, pero al que solo pueden entrar mujeres.</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZbVoAmrghOJUizp_R_Psa-5uGt9e1BX1lUApL3yZDSVEiCqZ99eKRiPjfzzspkXQFOGNsuqqDU6RHrp5tZ-A5sB3nuE_E8E21Ab3QIgF5WKlcs7RYoZr52ITAnyuhqDinLrWT7DDMHbqA/s1600-h/Erinn+Clark2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZbVoAmrghOJUizp_R_Psa-5uGt9e1BX1lUApL3yZDSVEiCqZ99eKRiPjfzzspkXQFOGNsuqqDU6RHrp5tZ-A5sB3nuE_E8E21Ab3QIgF5WKlcs7RYoZr52ITAnyuhqDinLrWT7DDMHbqA/s320/Erinn+Clark2.jpg" alt="" id="BLOGGER_PHOTO_ID_5244795697742043714" border="0" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj93s0qlN1x9gjApOYr9PkYgh4sQBUCWbQz-eMs9y_gMOuXVwK7lZJK__BeC3VCqvcWCiydjWhBMJ91GGfKKJBuCtSE6FHWBolnn3zMULsW2pvebAZkrk8kSCpWftwYA7-7-5_051Vnv9vw/s1600-h/Erinn+Clark.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj93s0qlN1x9gjApOYr9PkYgh4sQBUCWbQz-eMs9y_gMOuXVwK7lZJK__BeC3VCqvcWCiydjWhBMJ91GGfKKJBuCtSE6FHWBolnn3zMULsW2pvebAZkrk8kSCpWftwYA7-7-5_051Vnv9vw/s320/Erinn+Clark.jpg" alt="" id="BLOGGER_PHOTO_ID_5244795602213018722" border="0" /></a><br /><br /><strong style="font-family: arial;">Valerie Henson</strong><span style="font-family:arial;">: Val (así le dice todo el mundo) es una hacker (</span><span style="font-weight: bold;font-family:arial;" >UNA HACKER!!!!</span><span style="font-family:arial;">) del Kernel de Linux especializada en el desarrollo de filesystems. Actualmente trabaja para Red Hat.</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTuOEj3QAIcQQ4DYdnakVu5C3H0ofpOb-4X1kkBPSHkRZ3nOG_lgcsejFLXQ0NYN0ZOqQTpShANcB165_Rugqxx-YfrhBZ-s6S3PE5ntljCA0zk3zexqz69EECur7Fh3VTI5782PhVQPqp/s1600-h/Valerie+Henson.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTuOEj3QAIcQQ4DYdnakVu5C3H0ofpOb-4X1kkBPSHkRZ3nOG_lgcsejFLXQ0NYN0ZOqQTpShANcB165_Rugqxx-YfrhBZ-s6S3PE5ntljCA0zk3zexqz69EECur7Fh3VTI5782PhVQPqp/s320/Valerie+Henson.jpg" alt="" id="BLOGGER_PHOTO_ID_5244795929678247634" border="0" /></a><br /><br /><strong style="font-family: arial;">Pia Waugh</strong><span style="font-family:arial;">: Esta australiana está completamente dedicada al software libre. Es actualmente la presidenta de la organización Software Freedom Day y vicepresidente de Linux Australia. Al parecer tiene un gusto por las artes marciales... si sabe pelear y desarrollar en Linux... mis respetos la verdad.</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYmWZu4r2mASHQnbTmXPzE0YYWOaJAoZfyjohBATvOXwcMfLoOt0UOKrJY8oZsplPkPZOI3bvRQJSX167LqPtED-nk5doo6VVF2MAmFVZZlJzY7tWbrlCopxzD1QfdAbsab-bwzqapa6Om/s1600-h/PiaWaugh.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYmWZu4r2mASHQnbTmXPzE0YYWOaJAoZfyjohBATvOXwcMfLoOt0UOKrJY8oZsplPkPZOI3bvRQJSX167LqPtED-nk5doo6VVF2MAmFVZZlJzY7tWbrlCopxzD1QfdAbsab-bwzqapa6Om/s320/PiaWaugh.gif" alt="" id="BLOGGER_PHOTO_ID_5244796355323704114" border="0" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm3o5CIQ16NRnvS9mwZI7eO6jN9BJNUe1aSfr4qTSgDtyYaXn6EKO01kZOdr_Q4Q4vrpqg1r1s53jojRFyXF25UM5xcW8EslPX-S66r6hPqXkeMX_xP5LeeDpP__vu5mvC_h_1CbhX-nYN/s1600-h/Pia+Waugh.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm3o5CIQ16NRnvS9mwZI7eO6jN9BJNUe1aSfr4qTSgDtyYaXn6EKO01kZOdr_Q4Q4vrpqg1r1s53jojRFyXF25UM5xcW8EslPX-S66r6hPqXkeMX_xP5LeeDpP__vu5mvC_h_1CbhX-nYN/s320/Pia+Waugh.jpg" alt="" id="BLOGGER_PHOTO_ID_5244796226903059474" border="0" /></a><br /><br /><strong style="font-family: arial;">Eva Brucherseifer</strong><span style="font-family:arial;">: Ingeniera eléctrica de Alemania que está detrás de los proyectos KDE-Women, KDE-Edu y KDE-Solaris.</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWVl2_pvB8yda6Z8xIXZfh62NLfIZf2h0LEOboIGKr0XMVBFWhmFqlFKWognjJNT_uJeICU0q-eUWGxQgCqDLfA6qe-rvI8YyfkiP-tYdaisCGYV5piq5gplafcKNV9Jfbb20hxg6ZC9eG/s1600-h/Eva+Brucherseifer.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWVl2_pvB8yda6Z8xIXZfh62NLfIZf2h0LEOboIGKr0XMVBFWhmFqlFKWognjJNT_uJeICU0q-eUWGxQgCqDLfA6qe-rvI8YyfkiP-tYdaisCGYV5piq5gplafcKNV9Jfbb20hxg6ZC9eG/s320/Eva+Brucherseifer.jpg" alt="" id="BLOGGER_PHOTO_ID_5244796503568800466" border="0" /></a><br /><br /><span style="font-family:arial;">Y ellas son solo una pequeñisima muestra de la cantidad de mujeres profesionales dedicadas al mundo Linux, con exito en sus carreras y desarrollo profesional. Me parece genial que las mujeres esten entrando y fuerte en esta área en la que se creia solo para hombres.</span><br /><br /><span style="font-family:arial;">Despues de escribir esto, me quedo enamorado de mas de una de la lista de arriba... tal vez tener una novia Geek no sea despues de todo un sueño gaujiro.<br /><br />Chicas Geek, no dejen de visitar <a href="http://mauriciomoo.blogspot.com/2007/12/y-tique-clase-de-novio-te-gustara-tener.html">¿que clase de novio les gustaria tener?</a>.<br /></span>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com3tag:blogger.com,1999:blog-2740526033515456638.post-54696313874165685412008-09-06T14:37:00.005-05:002008-09-06T15:10:01.174-05:00REC<span style="font-family:arial;">Despues de tanto tiempo de no escribir en este Blog, regreso para recomendarles una película un tanto antigua, pero que no deja de estar buena. Del género de Horror, <span style="font-weight: bold;">REC</span> es una producción española co-dirigida por <span style="font-weight: bold;">Jaume Balagueró</span> y <span style="font-weight: bold;">Paco Plaza</span>. Fue estrenada en Noviembre del 2007 en España, pero llego a México este mes de Septiembre.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRLM2OSVaNjCoqO7uybDu0Qu6xyhzDK2TWp5jyPKp_ZxGNZe64Tqyvqr2zlR4fIX8KIqv9lvmmcONW9IAZOz3saI1CdjbxQ5Nb_VI4tGtpaN_kzjsLUwoCR32lCjee1dspW7EjlJqSXLqZ/s1600-h/rec1.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRLM2OSVaNjCoqO7uybDu0Qu6xyhzDK2TWp5jyPKp_ZxGNZe64Tqyvqr2zlR4fIX8KIqv9lvmmcONW9IAZOz3saI1CdjbxQ5Nb_VI4tGtpaN_kzjsLUwoCR32lCjee1dspW7EjlJqSXLqZ/s320/rec1.jpg" alt="" id="BLOGGER_PHOTO_ID_5243000377617558418" border="0" /></a><br /><br /></span> <span style="font-family:arial;">Lo interesante de esta película, es que esta hecha bajo el formato de un falso documental, muy al estilo de <span style="font-weight: bold;">Cloverfield</span>. Todo los hechos son narrados desde cámara al hombro, dando una sensación presencial de los hechos, aparte de marearte y llevarte uno que otro susto.</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtcVobaavTE3Y9ysPTq04loLdlHnQbbGzqp_xymLWQat6On55BZUMrpa0g_azQxHX2f1kacihsmRofAR1vDspRvWojByBaymZ6Q2Sx8mR7VIxXAkQfih_2er8T73QVnMDR2C5B-td0_hxl/s1600-h/rec.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtcVobaavTE3Y9ysPTq04loLdlHnQbbGzqp_xymLWQat6On55BZUMrpa0g_azQxHX2f1kacihsmRofAR1vDspRvWojByBaymZ6Q2Sx8mR7VIxXAkQfih_2er8T73QVnMDR2C5B-td0_hxl/s320/rec.jpg" alt="" id="BLOGGER_PHOTO_ID_5243000494483326514" border="0" /></a><br /><br /><br /><span style="font-family:arial;">Una reportera y su camarografo llevan a cabo una investigación con los bomberos de la ciudad, los cuales acompañan a uno de sus tantos llamados de emergencia, sin imaginarse el horror que se desataría.</span><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuWMpiLDKh8oOUoNnBdlvo3QeOIANmt1kHfjtEou_LpXyW5czibGHjN8F5R1hvo-nKVeg1asiGzAdVNcqGMKc1910oFgw5-qJ14KiV_M7iLoz8gFVbKrvrNkE-tD_TgAWO9HfR11fuZKdg/s1600-h/%5BREC%5D-6%5B3%5D.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuWMpiLDKh8oOUoNnBdlvo3QeOIANmt1kHfjtEou_LpXyW5czibGHjN8F5R1hvo-nKVeg1asiGzAdVNcqGMKc1910oFgw5-qJ14KiV_M7iLoz8gFVbKrvrNkE-tD_TgAWO9HfR11fuZKdg/s320/%5BREC%5D-6%5B3%5D.jpg" alt="" id="BLOGGER_PHOTO_ID_5243000565562952242" border="0" /></a><br /><br /><span style="font-family:arial;">Lo interesante de la película, es que a pesar de manejar un tema un tanto ya usado, la forma en que se desarrolla te lleva a estar imaginando lo que realmente esta pasando, el por que de los hechos, y lo peor de todo... como sobrevivir.</span> <span style="font-family:arial;">Esa sensación de huir con la cámara le da un toque de horror y hasta de sorpresa que no permite que te muevas de tu asiento por saber que pasará, hasta que ella misma hace que saltes del susto.</span> <span style="font-family:arial;">Una de las mejores producciones españolas a mi parecer, ganadora de varios premios, como mejor actriz, mejor director, y mejores efectos especiales. <span style="font-weight: bold;">REC</span> es sin duda una película altamente recomendable para aquellos que gusten del cine de horror.</span> <span style="font-family:arial;">Actualmente se esta construyendo el argumento de la 2a Parte, y en Hollywood ya preparan su versión, donde los hechos suceden en Los Angeles. Aquí les dejo el trailer de la película para que lo chequen.<br /></span><br /><br /><object height="344" width="425"><param name="movie" value="http://www.youtube.com/v/tqsOaV7NUVM&hl=en&fs=1"><param name="allowFullScreen" value="true"><embed src="http://www.youtube.com/v/tqsOaV7NUVM&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" height="344" width="425"></embed></object>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com0tag:blogger.com,1999:blog-2740526033515456638.post-35056019074122007042008-05-26T10:10:00.001-05:002008-05-26T10:19:02.646-05:00Killer TuxExcelente Video... con un estupendo final<br /><br /><object height="355" width="425"><param name="movie" value="http://www.youtube.com/v/W9_DQjQbtTY&hl=en"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/W9_DQjQbtTY&hl=en" type="application/x-shockwave-flash" wmode="transparent" height="355" width="425"></embed></object>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com2tag:blogger.com,1999:blog-2740526033515456638.post-87632227331304623192008-04-18T09:31:00.004-05:002008-04-18T10:00:02.618-05:00Niño Matemático predice el fin del mundo el 13 de Abril del 2036<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf32SNg71t-CKXm5qRSb2A_62mPIEWZzVsaOnAN9S7Ai6-bnoW5HN2kiVskXDKs41jYGWxe6XAYbrYfghLifLg4CaOv3XC1nORv0a3YlWa1k3ZcUaAlpvAeZgklEavCqL9Bbm1xSlG8cJg/s1600-h/Nico-Marquardt.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf32SNg71t-CKXm5qRSb2A_62mPIEWZzVsaOnAN9S7Ai6-bnoW5HN2kiVskXDKs41jYGWxe6XAYbrYfghLifLg4CaOv3XC1nORv0a3YlWa1k3ZcUaAlpvAeZgklEavCqL9Bbm1xSlG8cJg/s320/Nico-Marquardt.jpg" alt="" id="BLOGGER_PHOTO_ID_5190599783349661234" border="0" /></a>Aunque falta mucho para que la dichosa fecha nos alcance, es interesante saber el potencial matemático de <span style="font-weight: bold;">Nico Marquardt</span>, un chavito de 13 años que corrigió los cálculos de la <span style="font-weight: bold;">NASA</span> acerca de un asteroide que pasará muy cerca de la tierra en unos años.<br /><div style="text-align: justify;"><br />Segun la <span style="font-weight: bold;">NASA</span>, aproximadamente en el 2036, asteroide <span style="font-weight: bold;">Apophis</span> (Dios Egipcio de la Destrucción) pasará cerca de la tierra, casi a unos 32500 km, un distancia menor a la que hay entre nuestro planeta y la luna. Eso ocasionaría que a su paso impactará contra una enorme cantidad de satélites artificiales orbitandonos. Esto podría ocasionar el desvió de su trayectoria.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJD3xpBMwadTNI05x7oEV9yFpBUX1yvMAK3MpQGyC6y7EQihw-0fBb_H-u9gmCsSB_l_AX2eYL0CqQDhcf3zQO4eleQUmTVJ5AYK1GtOYY9vue4Uz7Axua1_V3XpSnptHVcvid0EnBTRff/s1600-h/apophis.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJD3xpBMwadTNI05x7oEV9yFpBUX1yvMAK3MpQGyC6y7EQihw-0fBb_H-u9gmCsSB_l_AX2eYL0CqQDhcf3zQO4eleQUmTVJ5AYK1GtOYY9vue4Uz7Axua1_V3XpSnptHVcvid0EnBTRff/s320/apophis.jpg" alt="" id="BLOGGER_PHOTO_ID_5190600002392993346" border="0" /></a><br />Ilustración del dios Apophis...<br /><br />Si bien nos va, lo alejarían de nosotros. Si mal nos va, lo mandarían directamente a la tierra. Pero supongamos que el asteroide <span style="font-weight: bold;">Apophis</span> pasará sin hacernos daño. Siete años después, cuando le de la vuelta al sol, regresaría muy cerca de nosotros. La <span style="font-weight: bold;">NASA</span> calculó 2 entre 100,000 la probalidad de que nos impactará.<br /><br />Pues el chaval, <span style="font-weight: bold;">Nico Marquardt</span>, desde el observatorio <span class="txtng13_rel"><span><span style="font-weight: bold;"> Instituto de Astrofísica de Postdam</span>, calculó que en realidad las posibilidades son de 2 entre 1000, cien veces menor que la <span style="font-weight: bold;">NASA</span>. Esto significaría que en el 2029 el <span style="font-weight: bold;">Apophis</span> pasará muy cerca de la tierra, y 7 años despues podría impactarnos de lleno, matando millones de personas, lanzando un Tsunami devastador y cubriendo la tierra de una gruesa capa de polvo que no dejaría pasar la luz del sol en años... el resto ya se lo imaginan.</span></span><br /><span class="txtng13_rel"><span></span></span><br />La <span style="font-weight: bold;">NASA</span> acepto su error, y reconoció los resultados de <span style="font-weight: bold;">Nico</span> como correctos. <span class="txtng13_rel"><span>Esperemos que para ese tiempo <span style="font-weight: bold;">Nico Marquardt</span> pueda, con sus calculos matemáticos, encontrar una manera de salvarnos... si no tendremos que revivir a <span style="font-weight: bold;">Bruce Willis</span> para que vaya al asteroide y lo haga explotar otra vez.</span></span><br /><span class="txtng13_rel"><span></span></span></div><span class="txtng13_rel"><strong></strong></span>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com4tag:blogger.com,1999:blog-2740526033515456638.post-48246760104873677632008-03-19T16:09:00.005-06:002008-03-19T16:28:02.873-06:00Gadgets Religiosos...la tecnología al servicio de la féMe encuentro con que la tecnología no esta peleada con la religión, como tal vez algunos pensarán. Al contrario, la iglesia católica ha demostrado muchas veces que es posible usarla para llevar la fe a cualquier parte del mundo... como el internet, tv de alta definición, entre otros.<br /><br />Pero los siguientes gadgets son muy originales, listos para ser usados tanto en el ámbito religioso como para alguien que se sienta atraído por esta singular moda.<br /><br /><div style="text-align: center;"><span style="font-weight: bold;">Una Biblia USB</span><br /></div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetbiblia.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetbiblia.jpg" alt="" border="0" /></a><br /><br />Con este singular gadget, podrás llevar este hermoso libre en formato digital a cualquier parte. Solo introducelo en un puerto USB y podrás leer cualquier pasaje.<br /><br /><div style="text-align: center;"><span style="font-weight: bold;">iRosario</span><br /></div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetrosario.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetrosario.jpg" alt="" border="0" /></a><br /><br />Es un rosario que tiene sus propios auriculares y al conectarse con tu iPod, copiara en el el rosario todas las oraciones y misterios... ahora no hay excusa de que no me lo se.<br /><br /><div style="text-align: center;"><span style="font-weight: bold;">Cruz MP3</span><br /></div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetcrucifijo.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetcrucifijo.jpg" alt="" border="0" /></a><br /><br />Un singular Reproductor MP3 en forma de Cruz de 1 Gb de capacidad, minipantalla LED y controles para su cómodo manejo.<br /><br /><div style="text-align: center;"><span style="font-weight: bold;">iBelieve</span><br /></div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetibeleave.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetibeleave.jpg" alt="" border="0" /></a><br /><br />Dock para tu ipod schuffle, con el cual controlaras la reproducción de tu música.<br /><br /><div style="text-align: center;"><span style="font-weight: bold;">Iglesia Portátil</span><br /></div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://fotos.eluniversal.com.mx/web_img/fotogaleria/igle2435.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://fotos.eluniversal.com.mx/web_img/fotogaleria/igle2435.jpg" alt="" border="0" /></a><br /><br />Que no es posible casar en cualquier parte ya no es pretexto con esta iglesia inflable, lista para ser montada en un salón de fiestas, casa, jardín, etc. Cuenta con su propio organo.<br /><br /><div style="text-align: center;"><span style="font-weight: bold;">Virgen USB</span><br /></div><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetvirgencita.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://fotos.eluniversal.com.mx/web_img/fotogaleria/gadgetvirgencita.jpg" alt="" border="0" /></a><br /><br />Memoria USB de 1 Gb de capacidad, cuyo imagen se iluminará al conectarse al equipo y cuando escribas información en ella.<br /><br />Este post es creado sin el áfan de molestar a nadie, sin importar la fe que profesen. Con información de http://multimedia.eluniversal.com.mx/fotogaleria.htmlDr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com4tag:blogger.com,1999:blog-2740526033515456638.post-85589306398507726992008-03-13T09:40:00.003-06:002008-03-14T08:28:06.160-06:00Simbolos Mayor que > y Menor que < en Ubuntu<div style="text-align: justify;"><span style="font-family:arial;">Busque y busque en la Web alguna ayuda acerca de como sacar los simbolos de <span style="font-weight: bold;">Mayor que ">"</span> y <span style="font-weight: bold;">Menor que "<"</span> en Ubuntu, pero nadie no encontre. Solo algunas burlas acerca de por que mi teclado no las traía... a razón de que era teclado de Laptop adaptado a EUA, es decir, la distribución de las teclas estaba en Ingles. Como rádico en México me era importante obtener esos símbolos.</span><br /><br /><span style="font-family:arial;">En windows los obtenía mediante código <span style="font-style: italic;">ASCII</span>, por que igual no era posible de la forma normal en un teclado de escritorio. Pero en Ubuntu no encontraba nada... ni siquiera en combinación de teclas.</span><br /><br /><span style="font-family:arial;">Pero un día, jugando con las teclas salío:</span><br /></div><br /><div style="text-align: center;"><span style="color: rgb(0, 0, 153);font-family:lucida grande;font-size:130%;" ><span style="font-weight: bold;">< = Alt + Shift + z</span><br /><span style="font-weight: bold;">> = Alt + Shift + x</span></span><br /></div><br />Esto en idioma español latinoamericano. Espero que alguien le sirva esto.Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com34tag:blogger.com,1999:blog-2740526033515456638.post-65554409683053688462008-03-07T12:26:00.004-06:002008-03-07T12:29:27.766-06:00Historia de una tabla autoreferenciadaCorrian los tiempos en que diseñaba una Base de Datos para un sistemita. La idea era una tabla que almacenará un catálogo de servicios con una descripción, un precio, etc. Al principio, no representaba mucho reto... era relativamente fácil la creación y edición de esta para después realizar las altas, bajas, consultas y modificaciones.<br /><br />Pero sucedió lo que a muchos desarrolladores les tiene que pasar algún día. Los requerimientos cambiarón... y una sola tabla no sería suficiente. Ahora era necesario catálogar esos mismos servicios, y tal vez lo primero que viene a la cabeza es crear una tabla mas con los catálogos y relacionarlos con la tabla de servicios.<br /><br />Sin embargo, en el caso de este desarrollador que se había dormido en sus clases de Base de Datos en los temas de Joins, SelfJoins, RigthJoins, etc., era algo que le complicaba su trabajo..., tener que crear esa clase de consultas SQL me ponía en un aprieto.<br /><br />Tenía que encontrar una manera de resolver el problema sin complicar el acceso a los datos, sobre todo pensando a futuro que las consultas SQL podrían tardarse mucho en ejecutarse debido a la enorme cantidad de datos que algún día manejaría.<br /><br />Así que, al método de prueba y error, se modificó el diseño de la tabla agregando dos columnas mas:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-RSMor78imPW7Xh3xWW0olepRRYrBA41hdJe0EXlCQdNrLUGIWEi96K9k6oiSiVxggc2CzdWcCHIOvN0F-pHX6lr065_xJvrNFq4qJyvjzfAc2qb4ekSVnucm_Y9ofxMJsPhHmgjjRusp/s1600-h/tabla.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-RSMor78imPW7Xh3xWW0olepRRYrBA41hdJe0EXlCQdNrLUGIWEi96K9k6oiSiVxggc2CzdWcCHIOvN0F-pHX6lr065_xJvrNFq4qJyvjzfAc2qb4ekSVnucm_Y9ofxMJsPhHmgjjRusp/s400/tabla.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5175068205893542594" /></a><br /><br />La columna TIPO y TIPO_RELACION resolvía mi problema. La idea era que cuando se agregará un cátalogo, este tendría automáticamente en su campo TIPO las letras CT que lo identifican como catálogo y en el campo TIPO_RELACION la letra T (o cualquier otra, incluso sin letra) concatenandole el ID del registro, que mas adelante sería utilizado.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2zhtWU1UmE8oMYWX9-gq1Qug9GX1Lb4geQUL7_9xgQaqSR4rixEOqQ1p8BAzeuVOzn2Co4eCf4FFUc0MxqTOnvDdh8M0Hzp70A0Vk0ypbxtheRxLvZYmnadtU_L7UMnxKmb5N0kpM7gb1/s1600-h/tabla2.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2zhtWU1UmE8oMYWX9-gq1Qug9GX1Lb4geQUL7_9xgQaqSR4rixEOqQ1p8BAzeuVOzn2Co4eCf4FFUc0MxqTOnvDdh8M0Hzp70A0Vk0ypbxtheRxLvZYmnadtU_L7UMnxKmb5N0kpM7gb1/s400/tabla2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5175068321857659602" /></a><br /><br />Agregado el catálogo, ahora era posible agregar un servicio que pertenecierá a ese catálogo, relacionado por el campo TIPO_RELACION. La imágen muestra el registro 13, donde se agregó un catálogo, con TIPO CT y TIPO_RELACION C13. Posteriormente, agregando mediante el sistema un servicio, este pertenece al catálogo anterior, colocando en su campo TIPO C13. De esta manera "apuntamos" el servicio a directamente con el catálogo que lo contendrá. Cabe mencionar que el campo TIPO_RELACION se quedo vació ya que este servicio no contendrá a nadie mas.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2_I_PjnwMgD_WNcNZu_E_OlazGh9pY9RWN8rnK9KjB-9SuWzl3JwnBJaPFug2osQsJ5uwB83tI8QLeponeMFjy4pIrfWaVX0bfWZJpYW0De3rWg9vJvzwyTZ8EtnPsn_PKGU-dW_AbfSL/s1600-h/tabla3.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2_I_PjnwMgD_WNcNZu_E_OlazGh9pY9RWN8rnK9KjB-9SuWzl3JwnBJaPFug2osQsJ5uwB83tI8QLeponeMFjy4pIrfWaVX0bfWZJpYW0De3rWg9vJvzwyTZ8EtnPsn_PKGU-dW_AbfSL/s400/tabla3.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5175068442116743906" /></a><br /><br />Fue así como conseguí, de pura casualidad una tabla autoreferenciada... o eso me lo dijo un cuate... e investigando me di cuenta que es algo muy útil, pero pocas veces utilizadas en las Bases de Datos. Analizando este método nos dimos cuenta que no solo se aplica en un solo nivel, si no que incluso se presta perfectamente para mas niveles de jerarquía, como por ejemplo, clasificar los catálogos, en otro catálogo, o incluso los servicios, podrían contener en su interior mas servicios y variantes... y a su vez estos. Un estilo de árbol jerarquíco cuya implementación es mas barata que utilizar un sin fín de tablas y relacionarlas todas entre ellas.<br /><br />Al final, las tablas autoreferenciadas me han funcionando muy bien, sin ninguna clase de problemas hasta la fecha.Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com4tag:blogger.com,1999:blog-2740526033515456638.post-3184121916169378092008-03-06T08:49:00.010-06:002008-03-07T11:50:42.345-06:00Conectando PostgreSQL con Java<div style="text-align: justify;"><span style="font-family:arial;">En este mini tutorial intentaré explicar la manera en conectar nuestra aplicación hecha en <span style="font-weight: bold;">JAVA</span> con la Base de Datos de <span style="font-weight: bold;">PostgreSQL</span>.</span><br /><br /><span style="font-family:arial;">Primero, es necesario descargarse el <span style="font-weight: bold;">JDBC Driver</span> para <span style="font-weight: bold;">PostgreSQL</span>. Este se encuentra en la página </span><a style="font-family: arial;" href="http://jdbc.postgresql.org/index.html">http://jdbc.postgresql.org/index.html</a><span style="font-family:arial;"> Obviamente, será necesario contar con nuestra Base de Datos funcionando para realizar las consultas necesarias.</span><br /><br /><span style="font-family:arial;">Posteriormente hay que determinar la manera de agregar este Driver a nuestro proyecto. <span style="font-weight: bold;">NetBeans</span> ofrece una manera mas que sencilla.</span><br /><br /><span style="font-family:arial;">Conociendo la ubicación de nuestro Driver y con el proyecto abierto, en el <span style="font-style: italic;">Panel de Proyectos</span>, ubicamos en el <span style="font-style: italic;">Árbol de Proyecto</span> la opción <span style="font-style: italic;">Libraries</span>, clic Derecho en ella y seleccionamos <span style="font-style: italic;">Add JAR / Folder...</span>, de esta manera estaremos</span><br /><span style="font-family:arial;">agregando ej <span style="font-weight: bold;">.JAR</span> del Driver que descargamos. Esto nos crea en nuestro proyecto una carpeta llamada <span style="font-style: italic;">"dist"</span> y en ella otra de nombre <span style="font-style: italic;">"lib"</span> donde esta nuestro Driver.</span><br /><br /><span style="font-family:arial;">Ahora, teniendo lo necesario, podemos probar nuestra conexión con <span style="font-weight: bold;">PostgreSQL</span> y realizar lo que nos concierne, Altas, Bajas y Modificaciones a nuestras tablas.</span><br /><br /><span style="font-family:arial;">Para empezar, debemos de importar lo siguiente:</span><br /><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >import java.sql.*;</span><br /><br /><span style="font-family:arial;">Cabe mencionar que hay una gran diferencia entre <span style="font-style: italic;">Select</span> y <span style="font-style: italic;">Update, Insert o Delete</span>, ya que no se aplican de igual manera. A continuación muestro el proceso para realizar un <span style="font-style: italic;">Select</span> (en idioma <span style="font-style: italic;">geek</span>, vamos a selectear)</span><br /><br /><span style="font-weight: bold; color: rgb(255, 0, 0);font-family:arial;" >public class Main{</span><br /><span style="font-weight: bold; color: rgb(255, 0, 0);font-family:arial;" >public static void main(String[] args){</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Variable para almacenar la URL de conexión a nuestra Base de Datos, si esta estuviera en otra máquina, necesitariamos estar registrados en ella y contar con su IP*/</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >String url = "jdbc:postgresql://localhost/moo";</span><br /><span style="font-family:arial;"> </span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >try{</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >//Acceso al Driver</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >Class.forName("org.postgresql.Driver");</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" >//La conexión con los parámetros necesarios</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >Connection con = DriverManager.getConnection( url,"postgres","postgres");</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >//Abrimos la conexión y la iniciamos</span><br /><span style="color: rgb(0, 0, 153); font-weight: bold;font-family:arial;" >Statement stmt = con.createStatement();</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" >/*Un ResultSet es como en .NET un DataSet, un arreglo temporal donde se almacenará el resultado de la consulta SQL*/</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >ResultSet rs;</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" >//Una variable String para almacenar la sentencia SQL</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >String query = "select id as ID from moo.usuarios";</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" >//En el ResultSet guardamos el resultado de ejecutar la consulta</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >rs = stmt.executeQuery(query);</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" >//En un ciclo while recorremos cada fila del resultado de nuestro <span style="font-style: italic;">Select</span></span><br /><span style="color: rgb(0, 0, 153); font-weight: bold;font-family:arial;" >while ( rs.next()){</span><br /><br /><span style="font-family:arial;"><span style="font-weight: bold; color: rgb(0, 102, 0);">/*Aqui practicamente podemos hacer lo que deseemos con el resultado, en mi caso solo lo mande a imprimir*/</span> </span><br /><span style="color: rgb(0, 0, 153); font-weight: bold;font-family:arial;" >System.out.println(rs.getString("ID") + "\t" + rs.getString("ID"));</span><br /><span style="color: rgb(0, 0, 153); font-weight: bold;font-family:arial;" >}</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" >//Cerramos la conexión</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >stmt.execute("END");</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >stmt.close();</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >con.close();</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >}</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >catch( Exception e ){</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >//Por si ocurre un error</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >System.out.println(e.getMessage());</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >e.printStackTrace();</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >}</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >}</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >}</span><br /><br /><span style="font-family:arial;">Para realizar todo aquello diferente a un <span style="font-style: italic;">Select</span>, utilzaremos lo siguiente:</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >/*Variable para almacenar la URL de conexión a nuestra Base de Datos, si esta estuviera en otra máquina, necesitariamos estar registrados en ella y contar con su IP*/</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > String url = "jdbc:postgresql://localhost/moo";</span><br /><span style="font-family:arial;"> </span><br /><span style="color: rgb(0, 0, 153); font-weight: bold;font-family:arial;" > try{</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" > //Acceso al Driver</span><br /><span style="color: rgb(0, 0, 153); font-weight: bold;font-family:arial;" > Class.forName("org.postgresql.Driver");</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" > //La conexión con los parámetros necesarios</span><br /><span style="color: rgb(0, 0, 153); font-weight: bold;font-family:arial;" > Connection con = DriverManager.getConnection( url,"postgres","postgres");</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" > //Abrimos la conexión y la iniciamos</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > Statement stmt = con.createStatement();</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" ></span><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" >//Una variable String para almacenar la sentencia SQL</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > String query = "update moo.usuarios set nombre = 'Mauricio' where id = '1'";<br /><br /></span> <span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" >//Ejecutamos la consulta SQL</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >stmt.executeQuery(query);</span><br /><br /><span style="font-weight: bold; color: rgb(0, 102, 0);font-family:arial;" >//Cerramos la conexión</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > stmt.execute("END");</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > stmt.close();</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > con.close();</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > }</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > catch( Exception e ){</span><br /><br /><span style="color: rgb(0, 102, 0); font-weight: bold;font-family:arial;" > //Por si ocurre un error</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > System.out.println(e.getMessage());</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > e.printStackTrace();<br />}<br /></span><br /><span style="font-family:arial;">Es muy importante tener en cuenta que si este método lo utilizas en una función para hacerla llamar cuando lo necesites, y quieras enviarle tanto argumentos como retornar resultados, en la función de <span style="font-style: italic;">Select</span> las líneas siguientes <span style="font-weight: bold;">NO</span> deben de estar presentes:</span><br /><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" >stmt.execute("END");</span><br /><span style="font-weight: bold; color: rgb(0, 0, 153);font-family:arial;" > stmt.close();</span><br /><br /><span style="font-family:arial;">Y en la parte de <span style="font-style: italic;">Update, Insert o Delete</span>, solo la siguiente línea:</span><br /><br /><span style="color: rgb(0, 0, 153); font-weight: bold;font-family:arial;" >stmt.execute("END");</span><br /><br /><span style="font-family:arial;">Espero que sea útil esta información.</span><br /></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com0tag:blogger.com,1999:blog-2740526033515456638.post-28132572724726723502008-02-22T09:48:00.014-06:002008-02-22T11:24:49.764-06:00Subir imágenes al Servidor y Guardarlas en tu Base de Datos<div style="text-align: justify;"><span style="font-family: arial;">Llega el momento de cualquier desarrollador Web... en la que tiene la necesidad de dar la oportunidad al cliente de subir imagenes al Servidor, tal vez su foto, avatar, etc. Así mismo, aquel que trabaje con Bases de Datos tambien buscará la oportunidad de guardar archivos de imágen en una tabla, para no tener problemas al momento de respaldar y no cargar con todos los archivos.</span><br /><br /><span style="font-family: arial;">En el siguiente Post se presenta la forma básica de hacer estas dos cosas, utilizando <span style="font-weight: bold;">.NET</span> y <span style="font-weight: bold;">C#</span> aunque facilmente puede ser aplicado en cualquier lenguaje o BD.</span><br /><br /><span style="font-family: arial;">En primer lugar, necesitamos agregar a nuestro código las siguientes referencias:</span><br /><br /><span style="font-family: arial; font-weight: bold; color: rgb(0, 0, 102);">using System.IO;</span><br /><span style="font-family: arial; font-weight: bold; color: rgb(0, 0, 102);">using System.Text;</span><br /><span style="font-family: arial; font-weight: bold; color: rgb(0, 0, 102);">using System.Drawing;</span><br /><br /><span style="font-family: arial;">Posteriormente, necesitamos el control <span style="font-weight: bold;">FileUpload</span>, el clásico cuadro de texto y botón para seleccionar la ruta del archivo que se desea.</span><br /><br /><span style="font-family: arial;">El procedimiento se divide en dos partes, subir la imagen al servidor y codificarla para su almacenamiento en la Base de Datos. Esta codificación se realizará en <span style="font-weight: bold;">Base64</span>, lista para almacenarse en un campo tipo texto.</span><br /><br /><span style="font-family: arial;">Iniciemos con el evento de un botón para subir la imagen:</span><br /><br /><span style="font-size:100%;"><span style="font-family: arial; font-weight: bold; color: rgb(0, 0, 102);">protected void bt_agregar_Click(object sender, EventArgs e)</span><br /><span style="font-family: arial; font-weight: bold; color: rgb(0, 0, 102);">{</span><span style="font-size: 10pt; font-family: arial; color: rgb(0, 0, 102); font-weight: bold;"></span><br /><span style="font-size: 10pt; font-family: arial; color: blue;"><span style="color: rgb(0, 102, 0);">//Variable que almacenará el nombre de la imagen</span><o:p></o:p></span><br /><span style="font-size: 10pt; font-family: arial; color: blue;">string</span><span style="font-size: 10pt; font-family: arial;"> imagen = <span style="color: maroon;">""</span>;<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: green;"></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style="color: green;">//Determinamos si se tiene un archivo que subir, una vez ya seleccionado.<o:p></o:p></span><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US">if</span><span style="font-size: 10pt; font-family: arial;"> (<span style="color: blue;">this</span>.FileUpload1.HasFile)<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span>{<o:p></o:p></span><br /><span style="font-size: 10pt; font-family: arial;"></span><br /><span style="font-size: 10pt; font-family: arial;"><span style="color: rgb(0, 102, 0);">//Se separa la extensión del nombre del archivo para validarla</span><o:p></o:p></span><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US"></span><br /><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US">string</span><span style="font-size: 10pt; font-family: arial;">[] nomExt = <span style="color: blue;">this</span>.FileUpload1.FileName.Split(<span style="color: maroon;">'.'</span>);<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: blue;">string</span> tipoFile = nomExt[nomExt.Length - 1];<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: green;"></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style="color: green;">//Revisamos si el archivo cuenta con una extension valida, pudiendo agregar o quitar.<o:p></o:p></span><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: blue;">if</span> ((tipoFile == <span style="color: maroon;">"jpg"</span>) || (tipoFile == <span style="color: maroon;">"png"</span>))<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span>{<o:p></o:p></span><br /><span style="font-size: 10pt; font-family: arial;"></span><br /><span style="font-size: 10pt; font-family: arial; color: rgb(0, 102, 0);">/*Si se cuenta con la extensión válida, procedemos a guardarla en el Servidor. FileUpload1.SaveAs solicita una cadena de texto con la ruta y el nombre del archivo.<o:p></o:p> Server.MapPath("~/") determina la ruta de nuestra aplicación en el servidor. Si deseamos, le concatenamos otra carpeta, previamente creada<span style="">*/</span><o:p></o:p></span><br /><span style="font-size: 10pt; font-family: arial; color: rgb(0, 102, 0);"></span><br /><span style="font-size: 10pt; font-family: arial; color: blue;">this</span><span style="font-size: 10pt; font-family: arial;">.FileUpload1.SaveAs(Server.MapPath(<span style="color: maroon;">"~/"</span>) + <span style="color: maroon;">"//moo//"</span> + <span style="color: blue;">this</span>.FileUpload1.FileName);<o:p></o:p></span><br /><span style="font-size: 10pt; font-family: arial;"></span><br /><span style="font-size: 10pt; font-family: arial;"><span style="color: rgb(0, 102, 0);">//Guardamos el nombre de la imagen</span><o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span>imagen = <span style="color: blue;">this</span>.FileUpload1.FileName;</span><br /><span style="font-size: 10pt; font-family: arial;"></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: green;">//Obtenemos su tamaño en bytes una vez que esta ya en el servidor</span><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span>System.IO.<span style="color: teal;">FileInfo</span> info_img = <span style="color: blue;">new</span> System.IO.<span style="color: teal;">FileInfo</span>(Server.MapPath(<span style="color: maroon;">"~/"</span>) + <span style="color: maroon;">"//moo//"</span> + <span style="color: blue;">this</span>.FileUpload1.FileName);<o:p></o:p></span><br /><span style="font-size: 10pt; font-family: arial;"></span><br /><span style="font-size: 10pt; font-family: arial;"><span style="color: rgb(0, 102, 0);">//Lo convertimos a double y calculamos su peso en KB.</span><o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US">double</span><span style="font-size: 10pt; font-family: arial;" lang="EN-US"> b_img = <span style="color: teal;">Convert</span>.ToDouble(info_img.Length);<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: blue;"></span><br /><span style="font-size: 10pt; font-family: arial; color: rgb(0, 102, 0);">//Limitamos el peso del archivo</span><br /><span style="font-size: 10pt; font-family: arial; color: blue;">if</span><span style="font-size: 10pt; font-family: arial;"> (b_img <= (512*1024))<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span>{<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: green;"><br />/*Si el tamaño es válido, codificamos la imagen en Base64, un previo antes de guardarla en la base de datos. Esto se hace mediante la funcion CodificarFoto. Le enviaremos a la funcion la ruta completa de la imagen en el Servidor. Nos retornara una variable con la imagen ya codificada en Base64*/<o:p></o:p></span></span><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US"></span><br /><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US">string</span><span style="font-size: 10pt; font-family: arial;" lang="EN-US"> img_bin = CodificarFoto(Server.MapPath(<span style="color: maroon;">"~/"</span>) + <span style="color: maroon;">"//moo//"</span> + <span style="color: blue;">this</span>.FileUpload1.FileName);<span style=""></span><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: green;">/*Guardamos la informacion en la Base de Datos. La variable img_bin contiene la imagen, pero codificada en texto, lista para almacenarse en un campo de tipos Texto o String de la Base de Datos. En esta parte puedes utilizar el método que desees para guardarla*/</span><br /><span style="font-size: 10pt; font-family: arial; color: green;"></span><br /><span style="font-size: 10pt; font-family: arial; color: green;">//Si lo deseamos, borramos del servidor la imagen, una vez que ya esta en la BD<o:p></o:p></span><span style="font-size: 10pt; font-family: arial;"><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: teal;" lang="EN-US">File</span><span style="font-size: 10pt; font-family: arial;" lang="EN-US">.Delete(Server.MapPath(<span style="color: maroon;">"~/"</span>) + <span style="color: maroon;">"//moo//"</span> + <span style="color: blue;">this</span>.FileUpload1.FileName);<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span>}<o:p></o:p><span style=""></span><span style="color: blue;"></span><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span>}<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span>}<o:p></o:p></span><span style="font-size: 10pt; line-height: 115%; font-family: arial;"><span style=""></span></span><br /><span style="font-size: 10pt; line-height: 115%; font-family: arial;"><span style=""></span>}<o:p></o:p></span><span style="font-family: arial;"> </span><br /><span style="font-family: arial; font-weight: bold; color: rgb(0, 0, 153);">}//Fin del evento del boton</span><br /><br /><span style="font-family: arial;">Ahora veamos la función para Codificar la Foto</span><br /><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US"></span><br /><span style="font-size: 10pt; font-family: arial; color: rgb(0, 0, 153); font-weight: bold;" lang="EN-US">public</span><span style="font-size: 10pt; font-family: arial;"><span style="font-weight: bold; color: rgb(0, 0, 153);"> string CodificarFoto(string sNombreArchivo)</span><o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: rgb(0, 0, 153); font-weight: bold;">{</span><o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: rgb(0, 102, 0);">//Variable para almacenar la imagen codificada</span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style="color: blue;">string</span> sBase64 = <span style="color: maroon;">""</span>;<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: green;"></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style="color: green;">//Utilizamos un FileStream para acceder a la imagen en el Servidor<o:p></o:p></span><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: teal;" lang="EN-US">FileStream</span><span style="font-size: 10pt; font-family: arial;" lang="EN-US"> fs = <span style="color: blue;">new</span> <span style="color: teal;">FileStream</span>(sNombreArchivo, <span style="color: teal;">FileMode</span>.OpenOrCreate, <span style="color: teal;">FileAccess</span>.Read);<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: green;"></span><br /><span style="font-size: 10pt; font-family: arial; color: green;">//Utilizamos un BinaryReader para pasar los datos de la imagen a un arreglo de bytes</span><br /><span style="font-size: 10pt; font-family: arial; color: green;"><o:p></o:p></span><span style="font-size: 10pt; font-family: arial;"><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: teal;" lang="EN-US">BinaryReader</span><span style="font-size: 10pt; font-family: arial;" lang="EN-US"> br = <span style="color: blue;">new</span> <span style="color: teal;">BinaryReader</span>(fs);<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span><span style="color: blue;">byte</span>[] bytes = <span style="color: blue;">new</span> <span style="color: blue;">byte</span>[(<span style="color: blue;">int</span>)fs.Length];<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span>br.Read(bytes, 0, bytes.Length);<o:p></o:p></span></span> </div><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial; text-align: justify;"><span style="font-size:100%;"><span style="font-size: 10pt;" lang="EN-US"><span style=""></span></span><span style="font-size: 10pt; color: green;">//Guardamos el arreglo de bytes<o:p></o:p></span><br /><span style="font-size: 10pt;"><span style=""></span></span><span style="font-size: 10pt;" lang="EN-US">sBase64 = <span style="color: teal;">Convert</span>.ToBase64String(bytes);<o:p></o:p><span style=""></span></span></span></p><div style="text-align: justify;"> </div><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial; text-align: justify;"><span style="font-size:100%;"><span style="font-size: 10pt;"><span style=""></span><span style="color: blue;">//Retornamos la variable<br />return</span> sBase64;<o:p></o:p><span style=""></span><br /><span style="color: green;"></span></span></span></p><div style="text-align: justify;"> </div><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial; text-align: justify;"><span style="font-size:100%;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: green;">//Se libera memoria<o:p></o:p></span><br /><span style=""></span>fs.Close();<o:p></o:p><br /><span style=""></span>fs = <span style="color: blue;">null</span>;<o:p></o:p><br /><span style=""></span>br = <span style="color: blue;">null</span>;<o:p></o:p><br /><span style=""></span>bytes = <span style="color: blue;">null</span>;<o:p></o:p></span></span></p><div style="text-align: justify;"><span style="font-size:100%;"><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span><span style="font-weight: bold; color: rgb(0, 0, 153);">}</span></span><br /><br /><span style="font-family: arial;">Por ultimo les dejo el código para descodificar la imagen. Se entiende que ya se habrá leido la Base de Datos y recuperado la cadena (imagen codificada)</span><br /><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US"></span><br /><span style="font-size: 10pt; font-family: arial; color: rgb(0, 0, 153); font-weight: bold;" lang="EN-US">private</span><span style="font-size: 10pt; font-family: arial;"><span style="font-weight: bold; color: rgb(0, 0, 153);"> void DecodificarFoto(string sBase64, string nombre_file)</span><o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: rgb(0, 0, 153); font-weight: bold;">{</span><o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;"><span style=""></span><span style="color: green;"></span><span style="color: rgb(0, 102, 0);">/*Guardamos en una cadena la ruta de la imagen donde se descodificará. Es decir, despues de este proceso, estara guardada en el disco duro del servidor*/</span></span><br /><span style="font-size: 10pt; font-family: arial; color: rgb(0, 102, 0);"><span style=""></span><span style=""></span></span><span style="font-size: 10pt; font-family: arial; color: blue;" lang="EN-US">string</span><span style="font-size: 10pt; font-family: arial;" lang="EN-US"> sImagenTemporal = Server.MapPath(<span style="color: maroon;">"~/"</span>) + <span style="color: maroon;">"moo//"</span> + nombre_file;<o:p></o:p><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style=""></span><span style="color: green;">//Utilizamos un FileStream para crear un nuevo archivo temporal</span></span><br /><span style="font-size: 10pt; font-family: arial;" lang="EN-US"><span style="color: green;"><o:p></o:p></span><span style=""></span><span style="color: teal;">FileStream</span> fs = <span style="color: blue;">new</span> <span style="color: teal;">FileStream</span>(sImagenTemporal, <span style="color: teal;">FileMode</span>.CreateNew, <span style="color: teal;">FileAccess</span>.Write);<o:p></o:p></span></span> </div><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial; text-align: justify;"><span style="font-size:100%;"><span style="font-size: 10pt;" lang="EN-US"><span style=""></span><span style="color: teal;"><span style="color: rgb(0, 102, 0);">//Un BinaryWriter para escribir la imagen descodificada</span><br />BinaryWriter</span> bw = <span style="color: blue;">new</span> <span style="color: teal;">BinaryWriter</span>(fs);<o:p></o:p><span style=""></span></span></span></p><div style="text-align: justify;"> </div><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial; text-align: justify;"><span style="font-size:100%;"><span style="font-size: 10pt;" lang="EN-US"><span style=""></span><span style="color: blue;"><span style="color: rgb(0, 102, 0);">//Un arreglo de Bytes para descodificar la imagen</span><br />byte</span>[] bytes;<o:p></o:p><span style=""><br /></span>bytes = <span style="color: teal;">Convert</span>.FromBase64String(sBase64);<o:p></o:p></span></span></p><div style="text-align: justify;"> </div><p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal; font-family: arial; text-align: justify;"><span style="font-size:100%;"><span style="font-size: 10pt;" lang="EN-US"><span style="color: rgb(0, 102, 0);">//Escribimos la imagen</span><br />bw.Write(bytes);<o:p></o:p><span style=""></span></span></span></p><div style="text-align: justify;"> </div><p style="font-family: arial; text-align: justify;" class="MsoNormal"><span style="font-size:100%;"><span style="font-size: 10pt;" lang="EN-US"><span style=""><span style="color: rgb(0, 102, 0);">//Liberamos memoria</span><br /></span>fs.Close();<o:p></o:p><span style=""><br /></span>bytes = <span style="color: blue;">null</span>;<o:p></o:p><br /><span style=""></span>bw = <span style="color: blue;">null</span>;<o:p></o:p><br /><span style=""></span>sBase64 = <span style="color: blue;">null</span>;<o:p></o:p></span><br /><span style="font-size: 10pt; line-height: 115%;" lang="EN-US"><span style=""></span><span style="color: rgb(0, 0, 153); font-weight: bold;">}</span></span></span></p>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com1tag:blogger.com,1999:blog-2740526033515456638.post-26397302178931053102008-02-21T09:53:00.038-06:002008-02-21T19:24:10.786-06:00Resolviendo los Misterios de Cloverfield<div style="text-align: justify;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6TcNVzc8MhmA3gSPgL1D9wz4UBms9D_qUXTzwNm7dq7NA0iZndxBkpJsrHnrym0ZB-vvfXO_V4y-gPNtVRtrdcgEQTvTVe8ZPP50SyJiMJCCqGhNhgXl0vD4J-UFf7dPKUfDmS4OY8ATT/s1600-h/cloverfield-1-18-08-poster.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6TcNVzc8MhmA3gSPgL1D9wz4UBms9D_qUXTzwNm7dq7NA0iZndxBkpJsrHnrym0ZB-vvfXO_V4y-gPNtVRtrdcgEQTvTVe8ZPP50SyJiMJCCqGhNhgXl0vD4J-UFf7dPKUfDmS4OY8ATT/s320/cloverfield-1-18-08-poster.jpg" alt="" id="BLOGGER_PHOTO_ID_5169559236822806978" border="0" /></a><br /><br />A estas alturas, todo aquel que haya visto la película de Cloverfield tendrá su propia crítica. Algunos les parecio buena, otros mala, y otros regular.... pero al final todos estamos de acuerdo en considerarla la película mas "mareadora" de todas. Por que no es su trama, la del problema, si no la propuesta de J. J. Abrams de contar esta historia de una forma (debemos de reconocerlo) original, aunque anteriormente habiamos visto eso en "El Proyecto de la Bruja Blair", el efecto que le dio es diferente. Esto ultimo es tal vez lo que causo la molestia de muchas personas, ya que el movimiento constante de la cámara y ruido extremo habrán causado el deseo de contar con una bolsa de vomito como la de los aviones o en su defecto, la de las palomitas o el vaso de refresco (obviamente vacias).<br /><br />J. J. Abrams es el creador de otra historia de misterio de mucho exito a nivel mundial, Lost. Esta persona es gustosa de manejar las historias, sin un principio y sin un fin, solo la duda y el misterio de lo que ocurre. Es ese otro detalle de la película de Cloverfield que da pie a las criticas de la gente.<br /><br />Es que hay que entender, que el objetivo no era una historia con un principio llamativo, ni tampoco un final feliz. Es simplemente la aparición de un mounstro en la ya tan golpeada ciudad de Nueva York, que decide hacer de las suyas destruyendo edificios y aplastando cuanto se atraviese a su paso. Todo esto lo vemos a través de la lente de una videocamara llevada por un grupo de personas tratando de salir de la ciudad.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhve0BTl05_j6lvv1iraxcYGxNqMNFpwuqomCHdqMoo_GvTMO6DRSshk27Bg_ZJQu2BZZvqIBiW77hWCETuPVIErR_OuuNocFgC_y-T9NsjXqlPmGYsLFvfz0LnQc8bW4zwjeRowGLCbEBB/s1600-h/monstruoso1.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhve0BTl05_j6lvv1iraxcYGxNqMNFpwuqomCHdqMoo_GvTMO6DRSshk27Bg_ZJQu2BZZvqIBiW77hWCETuPVIErR_OuuNocFgC_y-T9NsjXqlPmGYsLFvfz0LnQc8bW4zwjeRowGLCbEBB/s320/monstruoso1.jpg" alt="" id="BLOGGER_PHOTO_ID_5169559430096335314" border="0" /></a><br /><br />Los efectos son muy buenos, la historia no tan original, pero al final se consigue crear en el espectador, por lo menos, el efecto del mareo. Sin embargo, al mismo tiempo deja en muchas personas una sensación de algo incluso y sin sentido. Pero es de lo que se trata, no existe un final, solo la expectativa de una segunda parte, o el misterio de lo que habra pasado después.<br /><br />Así mismo durante la película, hay algunos detalles de los cuales los que la vimos nos quedamos con muchas dudas. Intentemos aclararlas un poco:<br /><br /><span style="font-weight: bold;">¿De donde rayos vino ese mounstro?.</span><br /><br />Durante la película se menciona mucho acerca del origen, y oficialmente no hay nada seguro. Incluso J. J. Abrams no sabe de donde provino, pero deja ver unas pistas que podrian resolver el miterio. En primer lugar, la bestia viene del mar, de aguas muy profundas del oceano Atlántico, pero no se sabe su origen. Simplemente salio y ataco la ciudad. Se puede entender que es una bestia que vivio durante miles años, en el fondo del mar y algo hizo que saliera. Al final de la pelicula, se alcanza a ver a lo lejos, como algo cae y levanta una gran cantidad de agua. Eso hace suponer que viene del espacio exterior, o algo cayo en el mar y lo obligo a salir. <a href="http://www.youtube.com/watch?v=8XYERYYOyJQ"><span style=""><span class="a">Video</span></span></a> Así mismo, existe un promocional donde se deja ver la relacion entre los seres humanos y la bestia, y hace suponer que pudo haber sido un experimento, o que ya sabian de su existencia. <a href="http://www.blogdecine.com/2008/01/08-informativos-especiales-sobre-un-ataque-monstruoso-cloverfield">Videos</a><br />Sea lo que haya sido, el origen no esta del todo claro.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQX1c1vMn0UjbJzkuw9ZecmOoLySlys1e93d9O6_quQ0_oFrqMM9xVnltq-GuqPxkZe1VWaqkQLF-LHq54zbtVtG5tZHV3xaAVa7Qzz0uIdahS9nWtUJRxFquL_yiqoUqRIc7XpNb3eZJB/s1600-h/los+protas+de+cloverfield.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQX1c1vMn0UjbJzkuw9ZecmOoLySlys1e93d9O6_quQ0_oFrqMM9xVnltq-GuqPxkZe1VWaqkQLF-LHq54zbtVtG5tZHV3xaAVa7Qzz0uIdahS9nWtUJRxFquL_yiqoUqRIc7XpNb3eZJB/s320/los+protas+de+cloverfield.jpg" alt="" id="BLOGGER_PHOTO_ID_5169559662024569314" border="0" /></a><br /><br /><span style="font-weight: bold;">¿Qué fue lo que exploto al principio del desastre en la ciudad?.</span><br /><br />El moustro entro por la bahía donde hay una gran cantidad de barcos y almacenes. Seguramente piso uno de estos, anunciando su salida a la superficie.<br /><br /><span style="font-weight: bold;">¿Por qué la cabeza de la estatua de la libertad?.</span><br /><br />La bestia, lo primero que encontro al llegar fue ese enorme monumento. Para inyectar dramatismo a la película le arranco la cabeza y la arrojo. (Desde 9-11 si quieres hacer una película dramática, destruye uno de los símbolos de los EUA). Igual la pudo haber dejado intacta.<br /><br /><span style="font-weight: bold;">¿Qué buscaba la bestia en la ciudad?.</span><br /><br />Se entiende que alimento, pero es posible que haya salido del mar para defenderse violentamente de algo que la haya provocado.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1o7dosP6R2gERopkM2BQ-fL-vbdWePBtbs14X42hCmCxsKjEG-_B__0qVaMsJ49upfhRHvB8GkXb474Typ51x7-RrSGMySiZL0daXJRSm8bA3RrAeq-99zg75Fqv2_cgE6Y7iRsUIexQ2/s1600-h/cloverfield2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1o7dosP6R2gERopkM2BQ-fL-vbdWePBtbs14X42hCmCxsKjEG-_B__0qVaMsJ49upfhRHvB8GkXb474Typ51x7-RrSGMySiZL0daXJRSm8bA3RrAeq-99zg75Fqv2_cgE6Y7iRsUIexQ2/s320/cloverfield2.jpg" alt="" id="BLOGGER_PHOTO_ID_5169560057161560562" border="0" /></a><br /><br /><span style="font-weight: bold;">¿Qué eran esas cosas tipo arañas mordían a la gente?</span><br /><br />Es lo único que a mi parecer no tenia sentido en la película, pero se entiende como sus pequeñas crías u otra clase de seres que se alimentan de los restos de lo que deja el moustro. Hay especies de tiburones que son acompañados siempre por un pequeño pescado que se alimenta de los restos que caen del hocico del animal. Sin embargo, las mordidas de estos animales, además de ser letales, inyectan una especie de veneno que aumenta la presión interna del cuerpo, provocando serias hemorragias. Estas mini bestias pueden echar abajo la idea de que provenía del mar, por que eran capaces de seguir a animales de sangre caliente como ratas y humanos, aparte de que sabían como andar en la superficie, paredes o techos. Lo que no quedo claro es que si eran capaces de ver, puesto que podían seguir a sus presas, pero tal vez guiadas por el olor, sonido o sensación.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcATvjmT_ET9UGnYb4lG7TbXiX3uKOmELFLfLqa9c14ga48UBND80FjPi0ovR4JLUzQBmXKX6s2srYdd0K9s96tLSLyK4YQc40cZBMNxvRtUBAT0EATWdX4wEZMeyCoKkZKXOW05eB7qK2/s1600-h/cloverfieldtr.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcATvjmT_ET9UGnYb4lG7TbXiX3uKOmELFLfLqa9c14ga48UBND80FjPi0ovR4JLUzQBmXKX6s2srYdd0K9s96tLSLyK4YQc40cZBMNxvRtUBAT0EATWdX4wEZMeyCoKkZKXOW05eB7qK2/s320/cloverfieldtr.jpg" alt="" id="BLOGGER_PHOTO_ID_5169561130903384594" border="0" /></a><br /><br /><span style="font-weight: bold;">¿Por que las bombas y proyectiles no le hacian nada?.</span><br /><br />Intentar matar un elefante con un revolver calibre .32 (muy pequeño) arroja el mismo resultado. La piel de la bestia era extremadamente dura, sin embargo, no indestructible. Hay muchas partes de la película donde se notan pedazos del mounstro caer, asi como quejidos y dolor ocasionado por las bombas. Pero todo esto, lejos de matarlo, al parecer lo enfurecía mas. La esperanza radicaba en una devastación total.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin0VzWsEiMUOqr5imBaC6CwmR9L1k_1mU9HrWydKb5l5daWocNhgZ6civE85OeN1Z5ukTFOyYxnPjhvY4cNKWyy1HnzXwIcB_akOmBir2z0SsTPKaBGeWMQxfPyZqj8sFWm3RLfn_pEI9H/s1600-h/23048.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin0VzWsEiMUOqr5imBaC6CwmR9L1k_1mU9HrWydKb5l5daWocNhgZ6civE85OeN1Z5ukTFOyYxnPjhvY4cNKWyy1HnzXwIcB_akOmBir2z0SsTPKaBGeWMQxfPyZqj8sFWm3RLfn_pEI9H/s320/23048.jpg" alt="" id="BLOGGER_PHOTO_ID_5169560675636851202" border="0" /></a><br /><br /><span style="font-weight: bold;">¿Qué paso al final?.</span><br /><br />No se sabe. Después de la devastación y de revelar un poco su origen, durante los créditos de la película se escucha claramente una transmisión de radio de alguien diciendo: "Help me.... its still alive". Existen rumores de una segunda parte de la película. Lo que esperamos es que pueda ser contada de diferente manera... no tan mareadora.<br /><br /><span style="font-weight: bold;">¿Por que Cloverfield?. ¿Qué significa?.</span><br /><br />Eso solo lo sabe J. J. Abrams. Era el nombre clave de su proyecto, que al final se lo dejo como oficial. En la cinta, el ejercito la presenta como una prueba de los incidentes de nombre clave Cloverfield.<br /><br />Al final, entretiene un rato la película, pero las opiniones difieren. Solo nos queda esperar una segunda parte, o enfrentarnos a un nuevo misterio:<a href="http://www.aladygma.com/"> ALADYGMA.</a> ¿Qué rayos es esto?. Solo sabemo lo que su página web muestra. Una serie de numeros que reta a descubrir la fecha de estreno y de lo que trataría.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8n1norCF5xLtoYM11B9OsYF-0z8PppGxq7j2-Uu7K0oQw2FGd1_CkeS8UXc3K0QJWVR0x4sn2R1bCmOFkRQKze_f2nlvEOmC69XpwNezkY8wiHvVFp9d5oxOH5M-I7mA5Ghyphenhyphenj5EYL9Q-k/s1600-h/cifras+abrams.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8n1norCF5xLtoYM11B9OsYF-0z8PppGxq7j2-Uu7K0oQw2FGd1_CkeS8UXc3K0QJWVR0x4sn2R1bCmOFkRQKze_f2nlvEOmC69XpwNezkY8wiHvVFp9d5oxOH5M-I7mA5Ghyphenhyphenj5EYL9Q-k/s320/cifras+abrams.jpg" alt="" id="BLOGGER_PHOTO_ID_5169562251889848866" border="0" /></a><br /><br />Les dejo algunos otros links dedicados a Cloverfield:<br /><br /><a href="http://www.1-18-08.com/">http://www.1-18-08.com/</a> Muestra fotografias del evento en Nueva York. Recomiendo que le subas el volumen y esperes alrededor de 6 minutos. Mientras puedes entretenerte resolviendo el acertijo. Consta de mirar la fotos y voltearlas para leer su contenido. Obviamente si ya viste la película sabras la respuesta, pero en ella se determina parte del origen de la bestia. Y no... la foto de la carne en la playa no son los restos de moustros, si no ballenas mutiladas cuyos cadaveres fueron arrastrados a la playa (Ya debes de tener la idea).<br /><br /><a href="http://www.youtube.com/watch?v=X0_cCM2y38Q&feature=related">http://www.youtube.com/watch?v=X0_cCM2y38Q&feature=related</a> Imagen escondida del mounstro... buena pista de J. J. Abrams.<br /><br /><a href="http://www.youtube.com/watch?v=K_zkpgGXb0Y&feature=related">http://www.youtube.com/watch?v=K_zkpgGXb0Y&feature=related</a> Este video, muestra los dos primeros trailers (con muy mala calidad) de la película, así como pistas acerca de lo que iba a ser Cloverfield.<br /><br /><a href="http://www.cloverfieldmovie.com/">http://www.cloverfieldmovie.com/</a> Página Oficial de la Película para bajar Wallpapers y RingTones ($$)<br /><br /><a href="http://www.theasylum.cc/product.php?id=139">http://www.theasylum.cc/product.php?id=139</a> Copia barata de Cloverfield, pero contada en Japon. Un terremoto ocurre en Tokyo, pero la verdad es mostrada por una cámara. Recomiendo ver el trailer.<br /><br />Nota: Cabe mencionar que aqui en México, Cloverfield no tuvo tanta promoción como en países como EUA, España o Japon.<br /></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com3tag:blogger.com,1999:blog-2740526033515456638.post-2290544660968284352008-02-19T10:33:00.006-06:002008-02-19T10:50:22.919-06:00Laptop para Estudiantes con Linux.... y a 100 Euros!!!<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7r8HbrpLvyAbPBM-5wEJHmApm6fNbA5N3gBK2NERIrhbAzU17BtOw-ZXnTbf1xnuh6mgo2JueAWRQQx0KVKzq5cSbCk28cpoBCuQBnBEqNd2eqhvZ7nKE7eqwMpRK3aBVVB8PDsKDODB7/s1600-h/one.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7r8HbrpLvyAbPBM-5wEJHmApm6fNbA5N3gBK2NERIrhbAzU17BtOw-ZXnTbf1xnuh6mgo2JueAWRQQx0KVKzq5cSbCk28cpoBCuQBnBEqNd2eqhvZ7nKE7eqwMpRK3aBVVB8PDsKDODB7/s320/one.png" alt="" id="BLOGGER_PHOTO_ID_5168730664616964530" border="0" /></a><br /><div style="text-align: justify;">Elonex ha publicado que a partir del 28 de Febrero de este año comenzara la venta de su Laptop ONE con Linux preinstalado al precio de 100 euros, dirigidas principalmente a estudiantes.<br /><br />Tendrs principalmente a Linux como sistema operativo, aunque no revelan que distribucion.... lo mas seguro es que sea una propia. Contara con wireless para la conexion a internet, y diversos paquetes escolares como Procesador de Textos, Hoja de Cálculo, Diseño de Imágenes, etc. Asi mismo contara con su reproductor multimedia a través de su aplicación y la tarjeta de sonido. Además contará con soporte a través de la ONEunion.<br /><br />Pesando aproximadamente un kilo, y de un tamaño pequeño, se vuelve ideal para ser llevada en una mochila. Ademas, por cada 100 laptops vendidad, Elonex donara una a algun niño de escasos recursos.<br /><br />Ojala esta oportunidad no solo se quede alla en Europa, sino que pueda llegar pronto a paises como el nuestro.<br /><br />Esta laptop sera presentada en el The Education Show. Para mas detalles, consulta aqui: <a href="http://www.elonex.co.uk/laptop/edushow.html">http://www.elonex.co.uk/laptop/edushow.html</a><br /><br />Para mas detalles: <a href="http://www.blogger.com/img/gl.link.gif">http://www.elonex.com/laptop/</a></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com2tag:blogger.com,1999:blog-2740526033515456638.post-36367401074799469592008-01-09T09:08:00.000-06:002008-01-09T09:27:31.540-06:00Ahora que resulta que Java es MALÍSIMO!!!!<div style="text-align: justify; font-weight: bold;">Resulta ser que los catedráticos eméritos Robert B.K. Dewar y el Dr. Edmond Schonberg, de la Universidad de Nueva York, y que pertenecen a la elite informática de ese país, criticaron muy fuerte al lenguaje mundialmente conocido y usado de JAVA.<br /><br />Ellos aseguran que esta causando graves problemas a todos los estudiantes, programadores y futuros programadores ya que el lenguaje orientado a objetos es tan sencillo de aprender e implementar, que nos olvidamos de los lenguajes fuertes y estables como C, C++, Lisp y ADA. Resulta ser que JAVA es considerado como "un camino fácil distante de la verdadera programacion".<br /><br />Segun estas personas, JAVA nos vuelve flojos, tirando solo lineas de código y no haciendo lo que deberiamos hacer que es "Programar".<br /><br />Caray...habra que decirle esto a las empresas que utilizan JAVA en sus sistemas, o a los potenciales clientes a los que se les entragara un sistema, ya que a ellos les importa un rábano si JAVA crea flojos o no, pues mientras el sistema haga lo que tenga que hacer, sea estable, seguro, eficiente y que sobre todo les de soluciones, pues creo yo que el programador es libre de elegir el lenguaje que quiera. Si es experto en JAVA, que lo use entonces. El objetivo aqui es "matar a la mosca" de la manera mas eficiente posible.<br /><br />Basado en: http://www.diarioti.com/gate/n.php?id=16275</div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com1tag:blogger.com,1999:blog-2740526033515456638.post-51947419708083353962007-12-21T17:24:00.000-06:002007-12-21T17:57:19.177-06:00Santa Claus usa Linux<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAS3eAONv85BlpkbJQvXTRbs4gC4LFrfh5yx-Zl9EdPiAMqXL5yinWV9uQAwtHjD1kC6EPIxxDbDSSC7ksAj7Tqyo5nNE4Ho0QxAtoJ21lnM-U1AygSOhn0alKCjVf4u7x_T_JZ9iuFKcz/s1600-h/regalos-de-navidad.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAS3eAONv85BlpkbJQvXTRbs4gC4LFrfh5yx-Zl9EdPiAMqXL5yinWV9uQAwtHjD1kC6EPIxxDbDSSC7ksAj7Tqyo5nNE4Ho0QxAtoJ21lnM-U1AygSOhn0alKCjVf4u7x_T_JZ9iuFKcz/s320/regalos-de-navidad.jpg" alt="" id="BLOGGER_PHOTO_ID_5146578545397015522" border="0" /></a><br /><br /><span style="font-family:arial;"><br /><br />Se imaginan el sistema que Santa Claus tienen para poder realizar su tarea anual de entregar juguetes alrededor del mundo. Seamos realistas....lo que nos contaban nuestros padres acerca del taller de juguetes y de un trineo jalado por renos difiere mucho a la realidad.</span><br /><br /><span style="font-family:arial;">Enlistes algunas cosas que Santa Claus seguro debe de tener:</span><br /><br /><span style="font-family:arial;">-Para empezar, usa Linux como principal sistema operativo. Por que la fase critica de toda su operacion es el mero 24 de diciembre...donde no puede correr el riesgo de que los servidores se caigan o se traben. ¿Distribucion?. No imagino cual, pero lo mas probable es que tenga alguna hecha por los propios duendes que trabajan con el. Cientos de duendes programadores que utilizan el kernel 2.4 como base para desarrollar y mantener el sistema que no descansa cada año.</span><br /><br /><span style="font-family:arial;">-Una Base de Datos PostgreSQL para almacenar todos aquellos niños y no tan niños que cada año le piden algo. Es ahi donde se guarda nuestro historial de las cosas buenas y malas, los pedidos que hemos hecho y los regalos que damos nosotros. Una base de datos que de segura tendra mirrors en diferentes partes del mundo y que se actualiza a diario. De ella, los registros no se dan de baja, solo se marca un campo ya sea en True o False "Tiene Espiritu Navideño"</span><br /><br /><span style="font-family:arial;">-Un centro de mando, con cientos de duendes en computadoras y una pantalla gigante donde se marcan los paises y sus regiones que faltan por repartir regalos ese dia tan especial. La mayoria de las pantallas corren en modo consola, pero algunas con interfaz grafica. Ahi, todos los duendes portan diademas con microfonos, y el 24 de diciembre es una noche donde estan mas alerta que nunca. El resto del año, el centro de mando es mas tranquilo, y se marca en el mapa, los lugares donde la gente hace cosas buenas y cosas malas.</span> <br /><br /><span style="font-family:arial;">-Un cuarto de servidores, de seguro, instalados en las zonas mas frias del mundo, como el polo norte, sur, finlandia, suiza, etc. Aparte de estar en temperaturas bajas, cuentan con un sistema de enfriamiento de lo mas sofisticado. Cuentan con un firewall muy poderoso, aunque a lo largo del tiempo vulnerable, donde mas de un hacker ha logrado burlarlo.</span><br /><br /><span style="font-family:arial;">-Su zona administrativa, cuenta con Ubuntu en su ultima version, para llevar a cabo la contabilidad generada por los pactos comerciales con empresas de juguetes como Mattel, Hasbro, etc. Hay algunas computadoras que tienen Windows, por las ventajas que se tiene al tener sistemas en ASP.NET y C# corriendo.</span><br /><br /><span style="font-family:arial;">-Santa Claus cuenta con una PDA de lo mas avanzado, donde actualiza la Base de Datos por cada casa que visita durante la noche buena. Aparte, el sistema con el que se controla su trineo esta hecho en JAVA, tal cual como los robots que fueron a Marte, para evitar problemas gracias al Garbage Collector</span><br /><br /><span style="font-family:arial;">-Relaciones comerciales con Microsoft y Apple para los regalos de navidad. Aunque si de contratos se trata acerca de seguridad, soporte tecnico y capacitacion, empresas de software libre son las primeras en ser llamadas.</span> <span style="font-family:arial;">-Un sistema de transporte inmeso, pactado con UPS, FEDEX, etc., que le ayudan a transportar durante el año, cantidad enormes de regalos al Asia Central, donde estudios recientes indican que es la mejor zona para iniciar el viaje de Noche Buena.</span><br /><br /><span style="font-family:arial;">-Y bueno, cosas asi como los Renos, que continuan tirando al trineo, solo que con una ayudadita de un sistema de propulsion basado en los cohetes espaciales. Asi como el famoso taller de juguetes, donde se fabrican todos aquellos que no son de marca, pero que sin embargo, causan una gran ilusion y alegria en quien los juega.</span> <span style="font-family:arial;">Es que de eso se trata la navidad...de paz, amor, festejo, pero sobre todo estar con la gente que se quiere. Y si esto ultimo no es posible, no olvidar que siempre hay un lugar donde compartir tan bella noche como la de Noche Buena.</span> <span style="font-weight: bold;font-family:arial;" >Por eso y muchas cosas mas....que pasen en una verdadera y fantastica Feliz Navidad 2007 !!!!<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAS3eAONv85BlpkbJQvXTRbs4gC4LFrfh5yx-Zl9EdPiAMqXL5yinWV9uQAwtHjD1kC6EPIxxDbDSSC7ksAj7Tqyo5nNE4Ho0QxAtoJ21lnM-U1AygSOhn0alKCjVf4u7x_T_JZ9iuFKcz/s1600-h/regalos-de-navidad.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAS3eAONv85BlpkbJQvXTRbs4gC4LFrfh5yx-Zl9EdPiAMqXL5yinWV9uQAwtHjD1kC6EPIxxDbDSSC7ksAj7Tqyo5nNE4Ho0QxAtoJ21lnM-U1AygSOhn0alKCjVf4u7x_T_JZ9iuFKcz/s320/regalos-de-navidad.jpg" alt="" id="BLOGGER_PHOTO_ID_5146578545397015522" border="0" /></a><br /><div style="text-align: justify;"><span style="font-family:arial;"><br /><br /><br /></span> <span style="font-family:arial;">Los mejores deseos:</span> <span style="font-weight: bold;font-family:arial;" >Dr. Omm</span><br /></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com3tag:blogger.com,1999:blog-2740526033515456638.post-78257578849340560252007-12-21T13:07:00.000-06:002007-12-21T13:23:54.300-06:00Santa Claus se cambia de casa !!!!....o tiene muchas sucursales?<div style="text-align: justify;"><span style="font-family: arial;">Resulta ser que todos hemos creido que Santa Claus vive en el polo norte....pero no es cierto. Estudios recientes ubican el taller de santa entre las </span><span style="font-family: arial;" class="a13g">montañas de Kirguizistán, en la frontera con Kazajistán, en Asia Central. ¿Por que ahi?. Ah por que es el mejor lugar para que el trineo pueda salir y darle la vuelta al mundo a una velocidad increible...con el fin de ganar el amanecer del 25 de diciembre. Estos estudios se basan en datos demográficos y otros, como la rotación de la tierra.</span><br /><span style="font-family: arial;" class="a13g"></span><br /><span style="font-family: arial;" class="a13g">Pero ahora resula que hay otros paises que aseguran que Santa Claus vive en sus tierras. Por ejemplo, la región finlandesa de Laponia y Groenlandia, territorio autónomo perteneciente a Dinamarca, reclaman desde hace años el derecho a hacer suyo el lugar de residencia de Papá Noel.</span><br /><span style="font-family: arial;" class="a13g"></span><br /><span style="font-family: arial;" class="a13g">Sin embargo, el personaje real en que se inspira Papá Noel o Santa Claus es San Nicolás, un obispo que vivió en el siglo IV en la actual Turquía.</span><br /><span style="font-family: arial;" class="a13g"></span><br /><span style="font-family: arial;" class="a13g"><p align="justify">Pero para Finlandia Papá Noel vive en la colina de Korvatunturi, cerca de la frontera norte con Rusia, desde donde se desplaza todos los días a su taller de juguetes de Rovaniemi, en la Laponia finlandesa, en el Círculo Polar Ártico. Es en este pais donde llegan 700,000 cartas todos los años, dirigidas a Santa Claus.</p></span><br /><span style="font-family: arial;" class="a13g"></span><span style="font-family: arial;">Para Dinamarca, el "julemand" (hombre de Navidad) vive en Nuuk, la capital de Groenlandia, donse a su oficina postal alrededor de 50.000 cartas.</span><br /><br /><span style="font-family: arial;" class="a13g"> También reclama, aunque con menos fuerza, Suiza, que aseguran que el "jultomten" (gnomo de Navidad) vive en Arvidsjaur, en la Laponia sueca, si bien la ciudad de Mora, más al sur, reclama también ese derecho, por el que compite igualmente Rusia.</span><br /><br /><br /><span style="font-family: arial;">Pero todo esto me hace pensar...que como cualquier corporacion multinacional, Santa Claus debe de tener en diferentes partes del mundo sucursales o talleres, donde se deben de procesar todos los pedidos de navidad. Tal vez la matriz este en el Polo Norte, y algunos mas pequeños en todos esos paises...sin contar con los tratados y acuerdos comerciales que tiene con las empresas de juguetes.</span><br /><br /><span style="font-family: arial;">Si el mejor lugar para partir es en Asia Central, es facil entender el transporte de todos los pedidos a esa zona para iniciar el viaje el 24 de diciembre.</span><br /></div>Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com1tag:blogger.com,1999:blog-2740526033515456638.post-36761683927220552572007-12-14T12:16:00.000-06:002007-12-14T12:21:42.509-06:00PAGO BECAS PRONABES!!!! LUNES 17 DE DICIEMBRE DE 2007Existe un anuncio en el tec colocado en estos ultimos dias, donde anuncian pago PRONABES en el tec los siguientes dias:<br /><span style="font-size:180%;"><br /></span><div style="text-align: justify;"><span style="color: rgb(0, 0, 102);font-size:180%;" ><span style="font-weight: bold;">Lunes 17 de Diciembre de 2007 de 14:00 a 18:00 hrs</span></span><br /><br /><span style="color: rgb(0, 0, 102);font-size:180%;" ><span style="font-weight: bold;">Martes 18 de Diciembre de 2007 de 10:00 a 12:30 y de 14:00 a 18:00 hrs</span></span><br /></div><br />Cabe mencionar que sera en la aula 20, hay que llevar copia de la credencial de elector y seran solo 2 meses.<br /><br />Una gran agradecimiento a mi amiga Karen, por la valiosisima información.<br /><br />Dr. Omm<br /><br />Nota: Fechas y Horarios pueden cambiar sin previo aviso, ya saben como es el tec.Dr Ommhttp://www.blogger.com/profile/04459603775875774245noreply@blogger.com0