tag:blogger.com,1999:blog-77824440474983000452024-03-18T20:03:04.048-07:00Mundo InformaticoYonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-7782444047498300045.post-61984631159728407972012-01-18T19:39:00.000-08:002012-01-18T19:43:59.550-08:00Instalación de Android-Eclipse<br />
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: left;">
Primero se tiene que descargar el SDK de android y eclipse. Luego de esto ejecutar en la carpeta de android/tool el programa que dice android saldra una ventana como la siguiente despues de esto hay que ir a available packages e instalar lo que se muestra instalado en la imagen mostrante. Aunque en mi caso descargue varios APIS pero solamente se podria instalar el mas reciente.</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaxYcarvnO5SYlNpfFSp9GpT2qHViSsba2w6S3A7ZAARx4LCtZMqPYW7-oaLBlyVWX3JVx7fnXGO_sloqfdzh_yoh8qRyEGTDCr9yWTZL6AKzLE3o5lq7JK2YSV_gXkOAzGQxN-VIsYsEp/s1600/Pantallazo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaxYcarvnO5SYlNpfFSp9GpT2qHViSsba2w6S3A7ZAARx4LCtZMqPYW7-oaLBlyVWX3JVx7fnXGO_sloqfdzh_yoh8qRyEGTDCr9yWTZL6AKzLE3o5lq7JK2YSV_gXkOAzGQxN-VIsYsEp/s320/Pantallazo.png" width="320" /></a></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
</div>
<div style="margin-bottom: 0cm; text-align: left;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Luego de esto se debe de crear los dispositivos virtuales en este caso se creo para cada API que se instalo pero bastara con colocar solamente uno.</div>
</div>
<div style="margin-bottom: 0cm; text-align: left;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgipZYfX-koQumqfSyDEhIn8ztK89ueYYMopCZ0tGM0nwyWRnQL5EejhNNw3nQvcser-Lj0mO_NMzKbqyakbbArROfTW1lYZv9otwnIHSSqxgeOJ7o6629qtxVImqDT2sGNyXrahY6SW0d4/s1600/Pantallazo-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgipZYfX-koQumqfSyDEhIn8ztK89ueYYMopCZ0tGM0nwyWRnQL5EejhNNw3nQvcser-Lj0mO_NMzKbqyakbbArROfTW1lYZv9otwnIHSSqxgeOJ7o6629qtxVImqDT2sGNyXrahY6SW0d4/s320/Pantallazo-1.png" width="320" /></a></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: left;">
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Luego de esto se debera de instalar el plugin de android en eclipse.</div>
</div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 0.5cm; margin-bottom: 0.53cm; padding-bottom: 0cm; padding-left: 0cm; padding-right: 0cm; padding-top: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span style="color: black;"><span style="font-family: Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif;">Se añadira el nuevo site en: Menú Help -> Install New Software -> Botón Add. El site es: </span></span><span style="color: #3b5998;"><span style="text-decoration: none;"><span style="font-family: Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif;"><span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"><a href="https://dl-ssl.google.com/android/eclipse/">https://dl-ssl.google.com/android/eclipse/</a> </span></span></span></span>y bastara con chequear lo que se desea y se instala el nuevo plugin.</div>
</div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 0.5cm; margin-bottom: 0.53cm; padding-bottom: 0cm; padding-left: 0cm; padding-right: 0cm; padding-top: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeLmgBPctA0A2Xax6D7lHw0-v8sS2F-pb544HG8WRXR3_Pp0o55g4HAGrr7iuglH4viC8_0jUgw5xtOocuzqnuwkkyqmexTuNu1jPrItK79TyQ_3l6OZKTxhr-zJXZOUFq5aHGA5rw-Plm/s1600/Pantallazo-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeLmgBPctA0A2Xax6D7lHw0-v8sS2F-pb544HG8WRXR3_Pp0o55g4HAGrr7iuglH4viC8_0jUgw5xtOocuzqnuwkkyqmexTuNu1jPrItK79TyQ_3l6OZKTxhr-zJXZOUFq5aHGA5rw-Plm/s320/Pantallazo-2.png" width="320" /></a></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 0.5cm; margin-bottom: 0.53cm; padding-bottom: 0cm; padding-left: 0cm; padding-right: 0cm; padding-top: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0cm; text-align: left;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
</div>
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Para crear un nuevo proyecto de android se debera de seleccionar File-> New -> Other</div>
</div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8_EtiP_JgHIPNhWvtRO2S02g3FxlJiu_x4NH0KYnyxlRgYqREGokvD-JV1XK-T8qZwaDkxN5sStbNxNCvZlnp-gcwUOObM_FJSM514ShBC6kd2bXto1UfonQKyTHs22LB5Ffp_XQjR0i0/s1600/Pantallazo-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8_EtiP_JgHIPNhWvtRO2S02g3FxlJiu_x4NH0KYnyxlRgYqREGokvD-JV1XK-T8qZwaDkxN5sStbNxNCvZlnp-gcwUOObM_FJSM514ShBC6kd2bXto1UfonQKyTHs22LB5Ffp_XQjR0i0/s320/Pantallazo-3.png" width="320" /></a></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: left;">
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Se selecciona Android -> Android Project y dar siguiente.</div>
</div>
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ6G3ymyZGWqb2VCcRZayL5cTHVQIXhVxX3sepEjPMU-Gzlzh3oPObn_qw4Sdxs-XX9nR3tKx98oAYaTkBqNCq4_RnVCSzQq3H7rqf7cJ-8MhdI_s4VliwXLxp64x_a1ArAZIKExR1FfgL/s1600/Pantallazo-4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ6G3ymyZGWqb2VCcRZayL5cTHVQIXhVxX3sepEjPMU-Gzlzh3oPObn_qw4Sdxs-XX9nR3tKx98oAYaTkBqNCq4_RnVCSzQq3H7rqf7cJ-8MhdI_s4VliwXLxp64x_a1ArAZIKExR1FfgL/s320/Pantallazo-4.png" width="320" /></a></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: left;">
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Saldra una ventana como la siguiente solo se debera de especificar el API y el nombre del proyecto tambien asi como el nombre de la aplcicacion y el Activity.</div>
</div>
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLIPKYDG2F8gW62eN5tp8vnF1-6AJsljfGR7hrnyVUOBp5upLw2M2vV0rIzw2hNCOaYqwYiYV89KB1wMNi4Xt2835SsStZJCCn_3qRS5kBlkQfA_BKu4Rr31OXO4Xn2GycKdMrrz0pRRq0/s1600/Pantallazo-5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLIPKYDG2F8gW62eN5tp8vnF1-6AJsljfGR7hrnyVUOBp5upLw2M2vV0rIzw2hNCOaYqwYiYV89KB1wMNi4Xt2835SsStZJCCn_3qRS5kBlkQfA_BKu4Rr31OXO4Xn2GycKdMrrz0pRRq0/s320/Pantallazo-5.png" width="320" /></a></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: left;">
<br /></div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
</div>
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
En este paso bastara solamente con Finalizar.</div>
</div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh12Vn6aV2m_9g5NITI6uBYS5pdBwsKsFFbXgxvB0mGZXVY0bjvaEUnjj1uVeNCO-thnHo8fRjTESOc8SpiTFaDoN99TpHTsEWsKT-g30uLsoqA9C-5-HyKpSNXbyApS_YrGOYVBSmnkD5l/s1600/Pantallazo-6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh12Vn6aV2m_9g5NITI6uBYS5pdBwsKsFFbXgxvB0mGZXVY0bjvaEUnjj1uVeNCO-thnHo8fRjTESOc8SpiTFaDoN99TpHTsEWsKT-g30uLsoqA9C-5-HyKpSNXbyApS_YrGOYVBSmnkD5l/s320/Pantallazo-6.png" width="320" /></a></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
</div>
<div style="margin-bottom: 0cm; text-align: left;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Para inicializar el emulador bastara con ejecutar el ejemplo que se ha creado y esto nos levatnara el emulador.</div>
</div>
<div style="margin-bottom: 0cm; text-align: left;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSVRcamVQ9sQcgp991lgY4SOYaDVzwnjRtNEHWA59aO8EYCYJx2W6K0LrhPlwxQ-eB75dbRyVhaSdW_29poVwaRyxpAjuK_Y8YprubRwm3AjG3qd-kDl9cMJlwakGs3bVViJZaWhyphenhyphenUaXtS/s1600/Pantallazo-7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSVRcamVQ9sQcgp991lgY4SOYaDVzwnjRtNEHWA59aO8EYCYJx2W6K0LrhPlwxQ-eB75dbRyVhaSdW_29poVwaRyxpAjuK_Y8YprubRwm3AjG3qd-kDl9cMJlwakGs3bVViJZaWhyphenhyphenUaXtS/s320/Pantallazo-7.png" width="320" /></a></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: left;">
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Ahora se procedera a colocarle botones, cuadros de texto a nuestra forma. Para esto se debe crear un layout se podria hacer en el mismo main.xml pero para hacerlo de mejor forma sera con esto. Para esto se debe agregar uno nuevo de la siguiente forma.</div>
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguFLEEZ0MqvkduLZNDndPFL_gH9ITwn75Q9YmbCiTZvsM6JmL_DJo_WWx7BetkXKh9a-p9FkdxNV3Pi8YXJ9CSHsfkB4xzps7YHHMx8C0CeBrxQ0EuTSMnKmU6R7Ngf4vcvrCn8qMS5Vbc/s1600/Pantallazo-10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguFLEEZ0MqvkduLZNDndPFL_gH9ITwn75Q9YmbCiTZvsM6JmL_DJo_WWx7BetkXKh9a-p9FkdxNV3Pi8YXJ9CSHsfkB4xzps7YHHMx8C0CeBrxQ0EuTSMnKmU6R7Ngf4vcvrCn8qMS5Vbc/s320/Pantallazo-10.png" width="320" /></a></div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<br /></div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Luego se Ejecuta la Aplicacion y se podra ver algo como lo siguiente.</div>
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div class="separator" style="clear: both; margin-bottom: 0.21cm; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigXJ44fsDIGWUS-WwkD3JHnnVXrf19p3vjXYuRyS4dBnsWHyNzKKyZzihooqpDJG_t6NKm_24aYdMvVAr-hVRGkXwuNnPYEUdEdUqFkKGvCEbouV1E78HRXfqGPiglzhXUWG4cur2lh9Qm/s1600/Pantallazo-9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigXJ44fsDIGWUS-WwkD3JHnnVXrf19p3vjXYuRyS4dBnsWHyNzKKyZzihooqpDJG_t6NKm_24aYdMvVAr-hVRGkXwuNnPYEUdEdUqFkKGvCEbouV1E78HRXfqGPiglzhXUWG4cur2lh9Qm/s320/Pantallazo-9.png" width="320" /></a></div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br /></div>
</div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
Desarrollado con eclipse-java-helios-SR2-linux-gtk y android-sdk_r11-linux_x86. Android Plataforma 3.1 API 12</div>
</div>
<div style="margin-bottom: 0.21cm; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br class="Apple-interchange-newline" /></div>Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com0tag:blogger.com,1999:blog-7782444047498300045.post-69750987496218158252012-01-15T21:57:00.000-08:002012-01-15T21:57:52.080-08:00JUNIT<br />
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px;">
<div style="line-height: 1.4; margin-bottom: 18px; text-align: justify;">
Junit es utilizado para realizar pruebas unitarias en aplicaciones java, esto es un framework que permite realizar la ejecución de clases java de manera controlada, con la finalidad de evaluar el funcionamiento de cada uno de los métodos de la clases esto para ver si se comportan como se esperan. Junit viene en Netbeans y en Eclipse por lo tanto las pruebas se realizaran más fácilmente que tener que descargar el jar de Junit estar configurando el classpath etc. Y teniendo Netbeans un plugin para que realice las pruebas de una clase de manera automática haciendo que el programador solo se enfoque en las pruebas y resultados esperados.</div>
</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px; text-align: justify;">
Junit permite timeouts en los test, comparación de arrayas con assertArrayEquals, configurar excepciones esperadas, ordenación, priorización, categorización y filtrado de text entre muchas más.</div>
<table border="1" cellpadding="0" cellspacing="0" style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-bottom-color: rgb(231, 231, 231) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; border-collapse: collapse; border-image: initial !important; border-left-color: rgb(231, 231, 231) !important; border-left-style: solid !important; border-left-width: 1px !important; border-right-color: rgb(231, 231, 231) !important; border-right-style: solid !important; border-right-width: 1px !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; color: #444444; cursor: default; font-family: Arial, 'Trebuchet MS', sans-serif; line-height: 1.4; margin-bottom: 22px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left; width: 643px;"><tbody style="line-height: 1.4;">
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">Método assert() de JUnit</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">Qué verifica</strong></td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertTrue(expresión)</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que expresión evalúe a true</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertFalse(expresión)</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que expresión evalúe a false</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertEquals(esperado,real)</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que esperado sea igual a real</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertNull(objeto)</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que objeto sea null</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertNotNull(objeto)</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que objeto no sea null</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertSame(objeto_esperado,objeto_real)</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que objeto_esperado y objeto_real sean el mismo objeto</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertNotSame(objeto_esperado,objeto_real)</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que objeto_esperado no sea el mismo objeto que objeto_real</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">fail()</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Hace que el test termine con fallo</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertArrayEquals() </strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que dos arrays sean iguales</td></tr>
<tr style="line-height: 1.4;"><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="52%"><strong style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-weight: bold; line-height: 1.4;">assertThat()</strong></td><td style="border-bottom-style: none !important; border-color: initial !important; border-image: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-color: rgb(231, 231, 231) !important; border-top-style: solid !important; border-top-width: 1px !important; border-width: initial !important; color: black; cursor: text; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; padding-bottom: 6px; padding-left: 24px; padding-right: 24px; padding-top: 6px;" valign="top" width="47%">Comprueba que satisface real la condición especificada en Matcher.</td></tr>
</tbody></table>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px; text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;"><span data-mce-style="text-decoration: underline;" style="line-height: 1.4; text-decoration: underline;">Testcase:</span></strong> Un testcase se define para ejecutar múltiples pruebas. Para definir un testcase se implementa una subclase de TestCase, se definen las variables de instancia que almacenan el estado del aparato, inicializar el estado accesorio primordial el programa de instalación setUp(), limpieza después de una prueba primordial por tearDown(). Cada prueba se ejecuta en su propio accesorio para que pueda haber efectos secundarios entre las ejecuciones de pruebas.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px; text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;"><span data-mce-style="text-decoration: underline;" style="line-height: 1.4; text-decoration: underline;">Testsuite:</span></strong> Un testsuite es una composición de pruebas. Puede extraer las pruebas que se ejecutan automáticamente, para ello se pasan a la clase del TestCase a la clase del constructor de testsuite.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px;">
TestSuite suite= new TestSuite();</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px;">
suite.addTest(new MathTest("testAdd"));</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px;">
suite.addTest(new MathTest("testDivideByZero"));</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px;">
o la segunda alternativa:</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px;">
TestSuite suite= new TestSuite(MathTest.class);</div>Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com0tag:blogger.com,1999:blog-7782444047498300045.post-86466688164552625382012-01-15T19:20:00.001-08:002012-01-15T19:20:53.912-08:00Abrir un documento desde Java<br />
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 21px; margin-bottom: 18px; text-align: justify;">
Si deseamos abrir un archivo con java bastara con colocar el siguiente método es decir si por ejemplo se desea abrir un archivo pdf con darle clic a un botón se coloca el siguiente código dentro del botón y este abrirá ya sea Acrobat Reader o la aplicación que tengamos por defecto para abrir el pdf</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f7f7f7; background-image: initial; background-origin: initial; color: #222222; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; font: normal normal normal 12px/18px Consolas, Monaco, monospace; line-height: 18px; margin-bottom: 18px; padding-bottom: 1.5em; padding-left: 1.5em; padding-right: 1.5em; padding-top: 1.5em;"> public void abrirArchivo()
{
try{
File path = new File("C:\miarchivo.pdf");
Desktop.getDesktop().open(path);
}catch(IOException e){
e.printStackTrace();
System.out.println("Ruta erronea");
}
}</pre>Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com1tag:blogger.com,1999:blog-7782444047498300045.post-70773093148477451352012-01-15T19:19:00.000-08:002012-01-15T19:19:43.988-08:00Escribir un archivo en Java<br />
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
El siguiente código realizado en java muestra como escribir un archivo en formato html el formato es independiente ya que la forma en que se escribirá un archivo de cualquier tipo es la misma.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
FileWriter: es para abrir y poder esscribir archivos se asocia con el objeto File.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
PrintWriter: Es para poder escribir sobre el archivo.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Try: Tratara de hacer el código dentro de el si surge un error se ir a la parte de catch.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
catch: Entrara a esta parte si a la hora de escribir o abrir el archivo hay un error como ejemplo si el archivo no existe o no se tenga privilegios para escribir en el archivo.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Finally: Esta parte siempre la hará.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Para realizar esto se necesita importar la siguiente libreria</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
import java.io.*;</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f7f7f7; background-image: initial; background-origin: initial; color: #222222; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; font: normal normal normal 12px/18px Consolas, Monaco, monospace; line-height: 18px; margin-bottom: 18px; padding-bottom: 1.5em; padding-left: 1.5em; padding-right: 1.5em; padding-top: 1.5em;"> public void EscribirHtml(){
FileWriter html=null;
PrintWriter pw=null;
try
{
html=new FileWriter("bitacora.html");
pw=new PrintWriter(html);
pw.println("<html>");
pw.println("<body bgcolor=black>");
pw.println("<head>");
pw.println("<title>");
pw.println("Bitacora de canciones / Videos Reproducidos");
pw.println("</title>");
pw.println("</head>");
pw.println("<font color=white size=+5, face=bell MT>");
pw.println("<h1 align=center>Canciones/ Videos Reproducidos</h1>");
pw.println("<hr width =100% color=White>");
pw.println("</font>");
pw.println("<br>");
pw.println("<br>");
pw.println("<font color=white size=+2,face=bell MT>");
pw.println("Video Reproducido");
pw.println("</font>");
pw.println("</html>");
pw.println("</body>");
}
catch(Exception e){
e.printStackTrace();
}
finally
{
try
{
if(null!=html)
html.close();
}
catch(Exception e2)
{
e2.printStackTrace();
}
}
}</pre>Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com0tag:blogger.com,1999:blog-7782444047498300045.post-6744850883800815312012-01-15T19:17:00.001-08:002012-01-15T19:17:52.317-08:00IPV6<br />
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
IPv6 quiere decir Protocolo de internet versión 6 fue creado para reemplazar IPv4 esto debido a que IPv4 no tiene la capacidad de soportar tanta demanda por lo tanto IPv6 tiene la capacidad para soportar toda la demanda del mercado. La capacidad de IPv4 es de 2^32 direcciones y uno se puede preguntar por qué crearon algo de ese tamaño es decir de un tamaño bastante limitado si se compara con la demanda actual de internet lo que paso es que IP4 casi como un experimento, no pensaron que pudiera tener tanto éxito comercial. Por lo tanto ahorita se están acabando las direcciones y por este motivo se creó y se estuvo experimentando con IPv6 en todo este tiempo también así el protocolo IPv6, dispone de 340 billones de billones de billones (sextillones) de direcciones. Esto debido a que pose direcciones con una longitud de 128 bits o en otro modo 340 sextillones. Esto no quiere decir que desaparecerá IPv4 bueno tal vez con el tiempo pueda ser muy posible pero IPv6 coexistirá con IPv4 esto debido a que muchas empresas trabajan con este protocolo y el cambio de toda su infraestructura y todo puede ser demasiado caro entonces IPv6 coexistirá con IPv4.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
Dentro de los cambios de IPv4 a IPv6 es que esta última especifica un nuevo <strong style="font-weight: bold; line-height: 1.4;">formato de paquetes</strong>, diseñado para minimizar el procesamiento del encabezado de paquetes. Debido a que las cabeceras de los paquetes estos son significativamente distintas, los dos protocolos no son interoperables. También así como ya se mencionó la<strong style="font-weight: bold; line-height: 1.4;"> capacidad de direccionamiento</strong> es mucho mayor que en IPv4 y el tamaño de la subred en IPv6 es de 2^64 el cuadrado del tamaño de la internet IPv4 entera con esto la tasa de utilización de espacio de direcciones será probablemnte menos en IPv6, pero la administración de las redes y el ruteo serán mas eficientes debido a las decisiones de diseño inherentes al mayor tamaño de las subredes y la agregación jerárquica de rutas.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
La habilidad para enviar paquetes únicos a destinos múltiples (<strong style="font-weight: bold; line-height: 1.4;">Multicast</strong>) es parte de las especificaciones de IPv6 mientras que en IPv4 es opcional. Esto debido a que la primera mencionada no hace uso de broadcast ya que pueden lograr lo mismo con multicast así que el broadcast de IPv4 es considerado una dirección normal en IPv6.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
IPv6 tiene la capacidad de ser <strong style="font-weight: bold; line-height: 1.4;">autoconfigurable</strong> es decir pueden configurarse a si mismos automáticamente cuando son conectados a una red ruteada en IPv6 a esto es comúnmente llamado una autoconfiguración de direcciones libres de estado. Si la autoconfiguración de direcciones libre de estado no es adecuada para una aplicación, es posible utilizar DHCPPv6 es un DHCP para ipv6 o se puede configurar de forma estática. Algo que cabe notar la seguridad de nivel de red con un protocolo IPsec es un protocolo para cifrado y autenticación IP esta en IPv6 en IPv4 este protocolo es opcional pero comúnmente implementado. Esta y muchas más diferencias hay entre IPv4 con IPv6.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
La<strong style="font-weight: bold; line-height: 1.4;"> notación para las direcciones IPv6</strong> estas direcciones se escriben como 8 grupos de cuatro dígitos hexadecimales.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
2008:0db8:1881:8a2e:4564: 08d3:1111:3afa</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
Si por ejemplo si se tuviera un grupo de 4 dígitos todos 0 es decir 0000 se puede comprimir es decir si existiera 0987:0000:454B se pude poner 0987::454B se realizara un ejemplo mas real 2008:1881:2881:8a2e:0000:08d3:0000:3afa-> 2008:1881:2881:8a2e::08d3::3afa</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
Identificación de tipos de direcciones:</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
::</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
La dirección con todo ceros se utiliza para indicar la ausencia de dirección, y no se asigna ningún nodo. ::1 La dirección de loopback es una dirección que puede usar un nodo para enviarse paquetes a sí mismo (corresponde con 127.0.0.1 de IPv4). No puede asignarse a ninguna interfaz física.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
::1.2.3.4</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
La dirección IPv4 compatible se usa como un mecanismo de transición en las redes duales IPv4/IPv6. Es un mecanismo que no se usa.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
::ffff:0:0</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
La dirección IPv4 mapeada se usa como mecanismo de transición en terminales duales.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
fe80::</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
El prefijo de enlace local (en inglés link local) específica que la dirección sólo es válida en el enlace físico local.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
fec0::</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
El prefijo de emplazamiento específico que la dirección sólo es válida dentro de una organización local.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
ff00::</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
El prefijo de multicast. Se usa para las direcciones multicast.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
Relación de estándares más importante de IPv6 se pueden encontrar:</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
• RFC1981 - Path MTU Discovery for IP version 6</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
• RFC2460 - Internet Protocol, Version 6 (IPv6) Specification</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
• RFC2461 - Neighbor Discovery for IP Version 6 (IPv6)</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
• RFC2462 - IPv6 Stateless Address Autoconfiguration</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
• RFC4291 - IP Version 6 Addressing Architecture</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
• RFC4443 - Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 • (IPv6) Specification</div>Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com0tag:blogger.com,1999:blog-7782444047498300045.post-68927948089758685202012-01-15T19:10:00.000-08:002012-01-15T19:10:27.506-08:00Conexion PHP con Mysql Usando Clases<br />
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Buen día en esta ocasión se pretende realizar una conexión sencilla de php con mysql pero no sera como se muestra en otros tutoriales se manejaran clases para optimizar mejor nuestro código y hacerlo mas modular. Para esto se deberá de crear un archivo en conexionphp.php y agregarle el codigo siguiente:</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f7f7f7; background-image: initial; background-origin: initial; color: #222222; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; font: normal normal normal 12px/18px Consolas, Monaco, monospace; line-height: 18px; margin-bottom: 18px; padding-bottom: 1.5em; padding-left: 1.5em; padding-right: 1.5em; padding-top: 1.5em;"><?php
class DBManager{
var $conect;
var $BaseDatos;
var $Servidor;
var $Usuario;
var $Clave;
function DBManager(){
$this->BaseDatos = "name_BD";
$this->Servidor="localhost";
$this->Usuario = "user";
$this->Clave = "pass";
}
function conectar() {
if(!($con=@mysql_connect($this->Servidor,
$this->Usuario,$this->Clave))){
echo"Error al conectar a la base de datos";
exit();
}
if (!@mysql_select_db($this->BaseDatos,$con)){
echo "Error al seleccionar la base de datos";
exit();
}
$this->conect=$con;
return true;
}
function cerrar(){
mysql_close($this->conect);
}
}
?></pre>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
Luego en la clase que se desea conectar a la base de datos se coloca lo siguiente:</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f7f7f7; background-image: initial; background-origin: initial; color: #222222; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; font: normal normal normal 12px/18px Consolas, Monaco, monospace; line-height: 18px; margin-bottom: 18px; padding-bottom: 1.5em; padding-left: 1.5em; padding-right: 1.5em; padding-top: 1.5em;"> <?php
include("conexionphp.php");
$conection=new DBManager;
if($conection->conectar()==true){
$val=mysql_query("SELECT * FROM name_tabla");
}
$conection->cerrar();
?></pre>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Este ultimo código podemos colocarlo en cualquier .php y así se hará que la contraseña y el password de nuestra base de datos no este en todos los archivos y si se desea cambiar de usuario bastara con cambiar la primer clase y todo estará bien.</div>Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com0tag:blogger.com,1999:blog-7782444047498300045.post-60311106624398776202012-01-15T18:59:00.001-08:002012-01-15T18:59:56.717-08:00Procedimiento Almacenado para un Login MySQL<br />
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Que tal es dia de hoy realizare un procedimiento almacenado que según el nombre de usuario y la contraseña regresara el id del usuario si el id es diferente de cero el usuario si existe de lo contrario no existe. Esto servirá mas que todo para trabajar de una forma mas segura y no validar o hacer verificaciones dentro del código php, .NET, jsp por mencionar algunos y bueno teniendo el id del usuario se pueden hacer maravillas después. Igual esto tambien servira de ejemplo de como utilizar los procedimientos almacenados.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
El procedimiento almacenado es el siguiente:</div>
<pre style="background-attachment: initial; background-clip: initial; background-color: #f7f7f7; background-image: initial; background-origin: initial; color: #222222; font-family: 'Courier 10 Pitch', Courier, monospace; font-size: 13px; font: normal normal normal 12px/18px Consolas, Monaco, monospace; line-height: 18px; margin-bottom: 18px; padding-bottom: 1.5em; padding-left: 1.5em; padding-right: 1.5em; padding-top: 1.5em;">CREATE PROCEDURE `login_usuario`(IN nombre CHAR(30),
IN passw CHAR(30),
OUT existe INT,
OUT user_name CHAR(30))
BEGIN
SET existe=0;
SELECT usuario_name,user_id into user_name,existe
FROM nombre_tabla
WHERE STRCMP(usuario_name,nombre)=0
AND STRCMP(passw,password)=0;
END</pre>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
bueno los parámetros que espero son nombre, passw(el password) como entradas es decir en MySQL cuando colocamos IN significan que ese dato es solo entrada en cambio OUT es lo que vamos a sacar y se quedara guardado luego en la base de datos que después se puede ir a verificar. También se podría colocar INOUT que servirá para los dos como entrada y salida.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
El cuerpo del procedimento almacenado debe estar entreo BEGIN y END. Para asignar un valor a una variable se le coloca el SET seguido del nombre de la variable = y el valor. Este SET existe=0 se coloca por que si no encuentra nada en la consulta retornara un 0 si no se colocara esto si no encontrara la variable el resultado seria NULL o el valor vació.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Luego con una simple consulta verificamos si existe el usuario y contraseña que se esta verificando en MySQL la comparación entre strings se realiza con STRCMP si es 0 significa que son iguales las dos cadenas. Si la primer cadena es mayor devuelve 1 de lo contrario devolverá -1.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Bueno ya sabiendo todo esto se procedera a ver como llamar a este procedimiento almacenado y como funcionara esto:</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
call login_usuario("yonatan","passwordprueba",@a,@b);</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Bastara con realizar esta consulta para llamara a este procedimiento almacenado el @a y @b son los parametros que serviran como salida mysql.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Luego despues de hacer esto se le dara:</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
SELECT @a y retornara el id del usuario luego de esto si el resultado es diferente de 0 el usuario existe y se le dará SELECT @b para obtener el nombre del usuario y mostrarlo en nuestra pagina.</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
Feliz dia Bendiciones</div>Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com2tag:blogger.com,1999:blog-7782444047498300045.post-69579956460596753522012-01-15T18:55:00.000-08:002012-01-15T18:57:05.907-08:00chkconfig Centos<br />
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
</div>
<div style="text-align: justify;">
Bueno en estos días he estado trabajando con un Servidor para Desarrollo en Centos y hay servicios así como Mysql que no se inician al entrar a linux y para no estar levantando todos los servicios cada vez que reiniciaba el servidor esta el chkconfig este contiene el registro de que servicios se inician con Centos y cuales no si se desea verificar que servicios están activados y cuales no y cuales se inician con linux y cuales no bastara con dar</div>
<div style="text-align: justify;">
chkconfig --list desde la consola y se mostrara algo como lo siguiente :</div>
<br />
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: center;">
<a data-mce-href="http://softwaredevelopment2011.files.wordpress.com/2011/06/chkconfiglist.png" href="http://softwaredevelopment2011.files.wordpress.com/2011/06/chkconfiglist.png" style="color: #cd4517; line-height: 1.4;"><img alt="" class="alignnone size-medium wp-image-8" data-mce-src="http://softwaredevelopment2011.files.wordpress.com/2011/06/chkconfiglist.png?w=297" height="300" src="http://softwaredevelopment2011.files.wordpress.com/2011/06/chkconfiglist.png?w=297" style="border-bottom-width: 0px; border-color: initial; border-image: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #444444; line-height: 1.4; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-width: 645px;" title="ChkconfigList" width="297" /></a></div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px; text-align: justify;">
como se darán cuenta muestra todos los servicios y su estado. Otra forma de verificar que servicios están activos es con:</div>
<div style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 18px;">
</div>
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;">service nombre_servicio status </strong></div>
<div style="text-align: justify;">
si se quiere levantar el servicio bastara con</div>
<strong style="font-weight: bold; line-height: 1.4;"></strong><br />
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;"><strong style="font-weight: bold; line-height: 1.4;"> service nombre_servicio start</strong></strong></div>
<strong style="font-weight: bold; line-height: 1.4;">
</strong><br />
<div style="text-align: justify;">
si se deseara para el servicio</div>
<strong style="font-weight: bold; line-height: 1.4;"></strong><br />
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;"><strong style="font-weight: bold; line-height: 1.4;"> service nombre_servicio stop</strong></strong></div>
<strong style="font-weight: bold; line-height: 1.4;">
</strong><br />
<div style="text-align: justify;">
bueno luego del paréntesis indicare el comando para que se inicie el programa cuando se inicie linux</div>
<div style="text-align: justify;">
bastara con colocar</div>
<strong style="font-weight: bold; line-height: 1.4;"></strong><br />
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;"><strong style="font-weight: bold; line-height: 1.4;">chkconfig nombre_servicio on</strong></strong></div>
<strong style="font-weight: bold; line-height: 1.4;">
</strong><br />
<div style="text-align: justify;">
por ejemplo para mysql</div>
<strong style="font-weight: bold; line-height: 1.4;"></strong><br />
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;"><strong style="font-weight: bold; line-height: 1.4;"> chkconfig mysqld on</strong></strong></div>
<strong style="font-weight: bold; line-height: 1.4;">
</strong><br />
<div style="text-align: justify;">
y listo con esto se iniciara el servicio mysql cuando se inicie linux</div>
<br />Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com0tag:blogger.com,1999:blog-7782444047498300045.post-59948208589539511162012-01-15T18:49:00.000-08:002012-01-15T18:49:03.430-08:00Triggers MYSQL<br />
<h3 style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 16px; font-weight: normal; line-height: 1.5em; margin-bottom: 18px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span style="font-size: 13px; line-height: 1.4;">Mysql es un DBMS que ha ganado campo a nivel empresarial ya que es una de los mejores DBMS en el mercado ademas de ser Open Source.</span></h3>
<div id="post-body-6981576486278745807" style="color: #444444; font-family: Arial, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: 18px;">
<div style="line-height: 1.4; text-align: justify;">
Lo que se vera ahorita es la utilización de Triggers o disparadores en esta herramienta estos son procedimientos que se ejecutan cuando sucede algún evento como eliminación , actualización o inserción de datos de una tabla especificada cuando se crea dicho Trigger.</div>
<div style="line-height: 1.4; margin-bottom: 18px; text-align: justify;">
La sintaxis de un trigger es la siguiente:</div>
<div style="line-height: 1.4; margin-bottom: 18px;">
</div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">CREATE TRIGGER </span><em style="border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 1.4;">name_trigger</em><span style="line-height: 1.4;"> </span><em style="border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 1.4;">evento_Disparador</em><span style="line-height: 1.4;"> ON </span><em style="border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 1.4;">name_tabla </em></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">FOR EACH ROW</span></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">BEGIN</span></div>
<em style="border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 1.4;"><div style="text-align: justify;">
<em style="border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 1.4;">CUERPO;</em></div>
</em><div style="text-align: justify;">
<span style="line-height: 1.4;">END</span></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;"><br /></span></div>
<br />
<div style="line-height: 1.4;">
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;">name_trigger:</strong></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">Indicara el nombre que se desea dar al trigger</span><span style="line-height: 1.4;">.</span></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;"><br /></span></div>
</div>
<div style="line-height: 1.4;">
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;">name_tabla</strong><span style="line-height: 1.4;">:</span></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">Nombre de la tabla a la cual se desea agregar el evento.</span></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;"><br /></span></div>
</div>
<div style="line-height: 1.4;">
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;">cuerpo:</strong></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">Estara todo los procesos aceptados por mysql como algun insert delete o incluso whiles, if, case cabe destacar que no existe for en procedimientos almacenados.</span></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;"><br /></span></div>
</div>
<div style="line-height: 1.4;">
<div style="text-align: justify;">
<strong style="font-weight: bold; line-height: 1.4;">evento_Disparador:</strong></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">En los eventos de los triggers estan BEFORE UPDATE, BEFORE INSERT, BEFORE DELETE, AFTER UPDATE, AFTER INSERT, AFTER DELETE.</span></div>
</div>
<div style="line-height: 1.4;">
<div style="text-align: justify;">
<span style="line-height: 1.4;">Algo tambien bastante importante es el uso de los alias NEW y OLD en las columnas estos alias sirven para referirse a las columnas como por ejemplo un update si se quiere saber el monto de la una cantidad antes de actualizarse se colocaría OLD.cantidad o por el contrario se coloca NEW.cantidad me podran decir para que serviria esto supongamos la base de datos de una compañia telefonica cuando nosotros ingresamos una recarga y antes teniamos saldo se tendria que sumar el saldo anterior (OLD.saldo) con un nuevo saldo(new saldo) ejemplo.</span></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;"><br /></span></div>
<div style="line-height: 1.4; text-align: justify;">
CREATE TRIGGER trigger_saldo Before Update ON Saldo</div>
<div style="line-height: 1.4; text-align: justify;">
FOR EACH ROW</div>
<div style="line-height: 1.4; text-align: justify;">
BEGIN</div>
<div style="line-height: 1.4; text-align: justify;">
SET NEW.saldo=NEW.saldo+OLD.saldo<em style="border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; line-height: 1.4;">;</em></div>
<div style="line-height: 1.4; text-align: justify;">
END</div>
<div style="line-height: 1.4; text-align: justify;">
<br /></div>
<div style="line-height: 1.4;">
<div style="text-align: justify;">
<span style="line-height: 1.4;">SET es para asignar el valor es propio de la sintaxis de Mysql y lo que se hace aqui es un disparador que cada vez que se actualice la tabla saldo que se sume el saldo viejo con el nuevo y se asgine al campo que va ingresar solo se pueden asignar valores a los campos NEW. campo a los OLD.campo no se les puede asignar valores.</span></div>
<div style="line-height: 1.4; margin-bottom: 18px;">
</div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">El alias OLD sirve para DELETE y UPDATE</span></div>
<div style="text-align: justify;">
<span style="line-height: 1.4;">El alias NEW UPDATE, INSERT</span></div>
</div>
</div>
</div>Yonatan Grajeda Cuesihttp://www.blogger.com/profile/12891441437798875445noreply@blogger.com0