<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Developeando</title>
	<atom:link href="http://developeando.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://developeando.net</link>
	<description>Diseño y desarrollo de software y videojuegos, seguridad informática y emprendimiento en la web.</description>
	<lastBuildDate>Thu, 25 Apr 2013 22:14:41 +0000</lastBuildDate>
	<language>es-ES</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Robot que inicie sesión en sitios web usando VB .NET (II)</title>
		<link>http://developeando.net/iniciar-sesion-web-vb-net/</link>
		<comments>http://developeando.net/iniciar-sesion-web-vb-net/#comments</comments>
		<pubDate>Tue, 28 Aug 2012 16:20:07 +0000</pubDate>
		<dc:creator>Fabián Rodríguez</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[Visual Basic .NET]]></category>

		<guid isPermaLink="false">http://developeando.net/?p=576</guid>
		<description><![CDATA[En el tutorial anterior de creación de robots web que interactuen con sitios web se vio como rellenar campos de un formulario. Practicando un poco más, en este tutorial se verá como iniciar sesión en Facebook.com identificando ciertos atributos HTML de los campos. Lo primero será reconocer todos los elementos HTML de la página, esto...]]></description>
				<content:encoded><![CDATA[<p>En el tutorial anterior de <a href="http://developeando.net/robots-web-visual-basic-i/" title="Creación de robots web">creación de robots web que interactuen con sitios web</a> se vio como rellenar campos de un formulario. Practicando un poco más, en este tutorial se verá como iniciar sesión en Facebook.com identificando ciertos atributos HTML de los campos.</p>
<p>Lo primero será reconocer todos los elementos HTML de la página, esto es posible hacerlo a través de una clase que guarda a manera de colección todos estos datos y es <em>HTMLElementCollection</em>.</p>
<p>Si revisamos el código fuente de Facebook.com, es decir, la ventana principal en donde se encuentra el login, cada campo, tanto el de usuario como el de contraseña tienen una estructura así:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;input type=&quot;text&quot; class=&quot;inputtext&quot; name=&quot;email&quot; id=&quot;email&quot; value=&quot;&quot; tabindex=&quot;1&quot;&gt;
&lt;input type=&quot;password&quot; class=&quot;inputtext&quot; name=&quot;pass&quot; id=&quot;pass&quot; tabindex=&quot;2&quot;&gt;</pre></div></div>

<p>Presentan bastante información como el atributo class, id, name y el value, y cualquiera de estos nos sirve para interactuar con los formulario. Veamos el código completo a implementar para llenar el formulario e iniciar sesión paso a paso:</p>
<p><strong>Paso 1</strong>: Insertamos un control WebBrowser y lo nombramos &#8220;<em>Browser</em>&#8220;, luego declaramos la variable que contendrá todos los elementos HTML.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #151B8D; font-weight: bold;">Dim</span> elementos <span style="color: #151B8D; font-weight: bold;">As</span> HtmlElementCollection = Browser.Document.All</pre></div></div>

<p><strong>Paso 2</strong>: Debemos recorrer ahora todos esos elementos en busca de uno que coincida con nuestras especificaciones, creamos un For Each para eso y dentro de él, ubicaremos una variable llamada &#8220;<em>elemento</em>&#8221; que será de tipo HTMLElement y representará cualquier elemento HTML obtenido de recorrer la colección:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> elemento <span style="color: #151B8D; font-weight: bold;">As</span> HtmlElement <span style="color: #8D38C9; font-weight: bold;">In</span> elementos
<span style="color: #008000;">'Más código
</span><span style="color: #8D38C9; font-weight: bold;">Next</span></pre></div></div>

<p><strong>Paso 3</strong>: Con el For Each ya vamos a recorrer los elementos, pero necesitamos decirle al programa que elemento vamos a buscar y que atributos tiene ese elemento. Entonces, basados en el código fuente de Facebook usaremos el atributo name de los campos y para ello usaremos el método GetAttribute, luego, cambiaremos el value de dicho elemento con SetAttribute:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"> <span style="color: #8D38C9; font-weight: bold;">If</span> elemento.GetAttribute(<span style="color: #800000;">&quot;name&quot;</span>) = <span style="color: #800000;">&quot;email&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
     elemento.SetAttribute(<span style="color: #800000;">&quot;value&quot;</span>, TxtUser.Text)
 <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
<span style="color: #8D38C9; font-weight: bold;">If</span> elemento.GetAttribute(<span style="color: #800000;">&quot;name&quot;</span>) = <span style="color: #800000;">&quot;pass&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
     elemento.SetAttribute(<span style="color: #800000;">&quot;value&quot;</span>, Txtpass.Text)
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span></pre></div></div>

<p><strong>Paso 4</strong>: Procesar el formulario. Una vez hemos llenado los campos, procedemos a dar click al botón de entrada o hacer la petición &#8220;submit&#8221;. Hay varios métodos, uno se trata de usar el número de formulario (empieza desde 0) y se invoca el miembro Submit:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Browser.Document.Forms(3).InvokeMember(<span style="color: #800000;">&quot;submit&quot;</span>)</pre></div></div>

<p>Y el otro método hace uso específicamente del botón de Facebook que dice &#8220;Entrar&#8221; por lo tanto si leemos el códgio fuente vemos:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;input value=&quot;Entrar&quot; tabindex=&quot;4&quot; type=&quot;submit&quot; id=&quot;u5whld_4&quot;&gt;</pre></div></div>

<p>Puedo identificarlo tanto por su value como por el id, y usaría un código así que haría uso del miembro &#8220;Click&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #8D38C9; font-weight: bold;">If</span> elemento.GetAttribute(<span style="color: #800000;">&quot;value&quot;</span>) = <span style="color: #800000;">&quot;Entrar&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
    elemento.InvokeMember(<span style="color: #800000;">&quot;click&quot;</span>)
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span></pre></div></div>

<p>El <strong>código fuente completo</strong> de nuestra aplicación quedaría así:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #E56717; font-weight: bold;">Public</span> Class Form1
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Form1_Load(<span style="color: #151B8D; font-weight: bold;">ByVal</span> sender <span style="color: #151B8D; font-weight: bold;">As</span> System.<span style="color: #F660AB; font-weight: bold;">Object</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> e <span style="color: #151B8D; font-weight: bold;">As</span> System.EventArgs) Handles MyBase.Load
        Browser.Navigate(<span style="color: #800000;">&quot;http://facebook.com&quot;</span>)
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Button1_Click(<span style="color: #151B8D; font-weight: bold;">ByVal</span> sender <span style="color: #151B8D; font-weight: bold;">As</span> System.<span style="color: #F660AB; font-weight: bold;">Object</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> e <span style="color: #151B8D; font-weight: bold;">As</span> System.EventArgs) Handles Button1.Click
        <span style="color: #151B8D; font-weight: bold;">Dim</span> elementos <span style="color: #151B8D; font-weight: bold;">As</span> HtmlElementCollection = Browser.Document.All
        <span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> elemento <span style="color: #151B8D; font-weight: bold;">As</span> HtmlElement <span style="color: #8D38C9; font-weight: bold;">In</span> elementos
            <span style="color: #8D38C9; font-weight: bold;">If</span> elemento.GetAttribute(<span style="color: #800000;">&quot;name&quot;</span>) = <span style="color: #800000;">&quot;email&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
                elemento.SetAttribute(<span style="color: #800000;">&quot;value&quot;</span>, TextBox1.Text)
            <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
            <span style="color: #8D38C9; font-weight: bold;">If</span> elemento.GetAttribute(<span style="color: #800000;">&quot;name&quot;</span>) = <span style="color: #800000;">&quot;pass&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
                elemento.SetAttribute(<span style="color: #800000;">&quot;value&quot;</span>, TextBox2.Text)
            <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
            <span style="color: #8D38C9; font-weight: bold;">If</span> elemento.GetAttribute(<span style="color: #800000;">&quot;value&quot;</span>) = <span style="color: #800000;">&quot;Entrar&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
                elemento.InvokeMember(<span style="color: #800000;">&quot;click&quot;</span>)
            <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
        <span style="color: #8D38C9; font-weight: bold;">Next</span>
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> Class</pre></div></div>

<p><a href="http://www.mediafire.com/?8at0d7fkh316lh9" title="Ficheros de bots de ejemplo">Descargar ficheros de ejemplo aquí</a>.</p>
<p>En la próxima guía identificaremos mejor como se usa el GetAttribute y el SetAttribute.</p>
]]></content:encoded>
			<wfw:commentRss>http://developeando.net/iniciar-sesion-web-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resolvedor automático de captcha con Antigate.com y VB .NET</title>
		<link>http://developeando.net/resolver-catpcha-vb-antigate/</link>
		<comments>http://developeando.net/resolver-catpcha-vb-antigate/#comments</comments>
		<pubDate>Mon, 27 Aug 2012 18:14:00 +0000</pubDate>
		<dc:creator>Fabián Rodríguez</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[Visual Basic .NET]]></category>

		<guid isPermaLink="false">http://developeando.net/?p=562</guid>
		<description><![CDATA[Que nuestras aplicaciones se integren con un resolvedor automático de captcha es imprescindible para automatizar ciertos procesos. Antigate.com, es un servicio que por $0.7USD resuelven 1000 captchas y el mínimo de compra son $10USD. Hoy veremos como integrar el api de este servicio a nuestra aplicación en Visual Basic .NET. Cuando creamos una cuenta en...]]></description>
				<content:encoded><![CDATA[<p>Que nuestras aplicaciones se integren con un <strong>resolvedor automático de captcha</strong> es imprescindible para automatizar ciertos procesos. <a href="http://antigate.com/" title="Antigate" rel="nofollow">Antigate.com</a>, es un servicio que por $0.7USD resuelven 1000 captchas y el mínimo de compra son $10USD. Hoy veremos como integrar el api de este servicio a nuestra aplicación en <a href="http://developeando.net/tag/visual-basic-net/" title="Visual Basic .NET">Visual Basic .NET</a>.</p>
<p>Cuando creamos una cuenta en este servicio y la cargamos con un monto mínimo en dólares, se nos entrega un API KEY que será la que integraremos con nuestro software. Cuando inicies sesión con tu cuenta podrás ver esta KEY en el menú <em>recognition > Access Key</em>.</p>
<p>El algoritmo a usar es el siguiente:</p>
<ol>
<li>El software envía el CAPTCHA por el método seleccionado (HTTP POST en multipart / form-codificar o base64 codificado) y obtiene su ID.</li>
<li>Esperar 10 &#8211; 20 segundos (Tiempo promedio en el que los trabajadores de Antigate tardan en resolver el Captcha).</li>
<li>Se hace una petición al servicio y se identifica con su API KEY. Puede devolver texto adivinado o CAPCHA_NOT_READY.</li>
<li>Si recibe el código CAPCHA_NOT_READY esperar 5 segundos y repetir el paso número 3.</li>
<li>Si obtiene OK | SOME_TEXT_HERE entonces SOME_TEXT_HERE es el texto de su captcha.</li>
</ol>
<p>Iniciamos ahora Visual Basic .NET y vamos a <strong>proyecto > Agregar clase</strong> y la nombramos como <strong>agapi</strong>. Allí insertamos todas estas funciones que no es necesario entenderlas ya que son las que proporciona el mismo API del sitio. Pero antes, hacemos los Imports:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Imports System.IO
Imports System.Collections.Specialized
Imports System.Threading
Imports System.Text
Imports System.Net
Imports System.Drawing.Imaging</pre></div></div>

<p>Y dentro de la clase agapi si podemos insertar todas estas funciones:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #E56717; font-weight: bold;">Function</span> GetCaptcha(<span style="color: #151B8D; font-weight: bold;">ByVal</span> UrlCaptcha <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> KeyC <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> MyStr <span style="color: #151B8D; font-weight: bold;">As</span> MemoryStream = Bmp2JpgUrl(UrlCaptcha)
        <span style="color: #151B8D; font-weight: bold;">Dim</span> nvc <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #E56717; font-weight: bold;">New</span> NameValueCollection()
        <span style="color: #151B8D; font-weight: bold;">Dim</span> CID <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
        nvc.Add(<span style="color: #800000;">&quot;method&quot;</span>, <span style="color: #800000;">&quot;post&quot;</span>)
        nvc.Add(<span style="color: #800000;">&quot;key&quot;</span>, KeyC)
        nvc.Add(<span style="color: #800000;">&quot;file&quot;</span>, <span style="color: #800000;">&quot;captcha.jpg&quot;</span>)
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Res <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = UploadFileStream(<span style="color: #800000;">&quot;http://antigate.com/in.php&quot;</span>, nvc, MyStr)
        <span style="color: #151B8D; font-weight: bold;">Dim</span> ResStr = <span style="color: #800000;">&quot;ERROR&quot;</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Sp(1) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
        Sp(0) = <span style="color: #800000;">&quot;|&quot;</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Resp() <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = Res.Split(Sp, StringSplitOptions.RemoveEmptyEntries)
        <span style="color: #8D38C9; font-weight: bold;">If</span> Resp.Length &lt;&gt; 2 <span style="color: #8D38C9; font-weight: bold;">Then</span>
            Return ResStr
        <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
        <span style="color: #8D38C9; font-weight: bold;">If</span> Resp(0) &lt;&gt; <span style="color: #800000;">&quot;OK&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
            Return ResStr
        <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
&nbsp;
        CID = Resp(1)
        Thread.Sleep(10000)
        ResStr = GetStatusCaptcha(CID, KeyC)
        <span style="color: #151B8D; font-weight: bold;">Dim</span> ip <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = 0
        <span style="color: #8D38C9; font-weight: bold;">While</span> ResStr = <span style="color: #800000;">&quot;ERROR&quot;</span> <span style="color: #8D38C9; font-weight: bold;">And</span> ip &lt; 4
            Thread.Sleep(5000)
            ResStr = GetStatusCaptcha(CID, KeyC)
        <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">While</span>
        Return ResStr
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span>
&nbsp;
&nbsp;
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Function</span> GetStatusCaptcha(<span style="color: #151B8D; font-weight: bold;">ByVal</span> CID <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> KeyC <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> LoadU = <span style="color: #800000;">&quot;http://antigate.com/res.php?key=&quot;</span> &amp; KeyC &amp; <span style="color: #800000;">&quot;&amp;action=get&amp;id=&quot;</span> &amp; CID
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Req <span style="color: #151B8D; font-weight: bold;">As</span> HttpWebRequest = CType(WebRequest.Create(LoadU), HttpWebRequest)
        Req.Method = <span style="color: #800000;">&quot;GET&quot;</span>
        Req.UserAgent = <span style="color: #800000;">&quot;Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0)&quot;</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> respreq <span style="color: #151B8D; font-weight: bold;">As</span> HttpWebResponse
        <span style="color: #151B8D; font-weight: bold;">Dim</span> receiveStream <span style="color: #151B8D; font-weight: bold;">As</span> Stream
        respreq = CType(Req.GetResponse(), HttpWebResponse)
        receiveStream = respreq.GetResponseStream()
        <span style="color: #151B8D; font-weight: bold;">Dim</span> StrRead <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #E56717; font-weight: bold;">New</span> StreamReader(receiveStream, Encoding.GetEncoding(1251))
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Res <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = StrRead.ReadToEnd()
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Sp(1) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
        Sp(0) = <span style="color: #800000;">&quot;|&quot;</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> ResStr = <span style="color: #800000;">&quot;ERROR&quot;</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Resp() <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = Res.Split(Sp, StringSplitOptions.RemoveEmptyEntries)
        <span style="color: #8D38C9; font-weight: bold;">If</span> Resp.Length &lt;&gt; 2 <span style="color: #8D38C9; font-weight: bold;">Then</span>
            Return ResStr
        <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
        <span style="color: #8D38C9; font-weight: bold;">If</span> Resp(0) &lt;&gt; <span style="color: #800000;">&quot;OK&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span>
            Return ResStr
        <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span>
        ResStr = Resp(1)
        Return ResStr
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span>
&nbsp;
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Function</span> UploadFileStream(<span style="color: #151B8D; font-weight: bold;">ByVal</span> Url <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> nvc <span style="color: #151B8D; font-weight: bold;">As</span> NameValueCollection, <span style="color: #151B8D; font-weight: bold;">ByVal</span> FStream <span style="color: #151B8D; font-weight: bold;">As</span> Stream) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> length <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Long</span> = 0
        <span style="color: #151B8D; font-weight: bold;">Dim</span> boundary <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = <span style="color: #800000;">&quot;----------------------------&quot;</span> &amp; DateTime.Now.Ticks.ToString(<span style="color: #800000;">&quot;x&quot;</span>)
        <span style="color: #151B8D; font-weight: bold;">Dim</span> httpWebRequest2 <span style="color: #151B8D; font-weight: bold;">As</span> HttpWebRequest = CType(WebRequest.Create(Url), HttpWebRequest)
        httpWebRequest2.ContentType = <span style="color: #800000;">&quot;multipart/form-data; boundary=&quot;</span> + boundary
        httpWebRequest2.Method = <span style="color: #800000;">&quot;POST&quot;</span>
        httpWebRequest2.KeepAlive = <span style="color: #00C2FF; font-weight: bold;">True</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> memStream <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #E56717; font-weight: bold;">New</span> MemoryStream()
        <span style="color: #151B8D; font-weight: bold;">Dim</span> boundarybytes() <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Byte</span> = Encoding.ASCII.GetBytes(Chr(13) &amp; Chr(10) &amp; <span style="color: #800000;">&quot;--&quot;</span> &amp; boundary &amp; Chr(13) &amp; Chr(10))
&nbsp;
        <span style="color: #151B8D; font-weight: bold;">Dim</span> formdataTemplate <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = Chr(13) &amp; Chr(10) &amp; <span style="color: #800000;">&quot;--&quot;</span> &amp; boundary &amp; Chr(13) &amp; Chr(10) &amp; <span style="color: #800000;">&quot;Content-Disposition: form-data; name=&quot;</span><span style="color: #800000;">&quot;{0}&quot;</span><span style="color: #800000;">&quot;;&quot;</span> &amp; Chr(13) &amp; Chr(10) &amp; Chr(13) &amp; Chr(10) &amp; <span style="color: #800000;">&quot;{1}&quot;</span>
&nbsp;
        <span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> key <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> <span style="color: #8D38C9; font-weight: bold;">In</span> nvc.Keys
            <span style="color: #151B8D; font-weight: bold;">Dim</span> formitem <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = <span style="color: #F660AB; font-weight: bold;">String</span>.Format(formdataTemplate, key, nvc(key))
            <span style="color: #151B8D; font-weight: bold;">Dim</span> formitembytes() <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Byte</span> = Encoding.GetEncoding(1251).GetBytes(formitem)
            memStream.Write(formitembytes, 0, formitembytes.Length)
        <span style="color: #8D38C9; font-weight: bold;">Next</span>
&nbsp;
        memStream.Write(boundarybytes, 0, boundarybytes.Length)
&nbsp;
        <span style="color: #151B8D; font-weight: bold;">Dim</span> headerTemplate <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = <span style="color: #800000;">&quot;--&quot;</span> &amp; boundary &amp; Chr(13) &amp; Chr(10) &amp; <span style="color: #800000;">&quot;Content-Disposition: form-data; name=&quot;</span><span style="color: #800000;">&quot;file&quot;</span><span style="color: #800000;">&quot;; filename=&quot;</span><span style="color: #800000;">&quot;captcha.jpg&quot;</span><span style="color: #800000;">&quot;&quot;</span> &amp; Chr(13) &amp; Chr(10) &amp; <span style="color: #800000;">&quot;Content-Type: image/pjpeg&quot;</span> &amp; Chr(13) &amp; Chr(10) &amp; Chr(13) &amp; Chr(10)
&nbsp;
        <span style="color: #151B8D; font-weight: bold;">Dim</span> headerbytes() <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Byte</span> = System.Text.Encoding.GetEncoding(1251).GetBytes(headerTemplate)
&nbsp;
        memStream.Write(headerbytes, 0, headerbytes.Length)
&nbsp;
        FStream.Position = 0
        <span style="color: #151B8D; font-weight: bold;">Dim</span> buffer(FStream.Length) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Byte</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> bytesRead <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Integer</span> = 0
        bytesRead = FStream.Read(buffer, 0, buffer.Length)
        memStream.Write(buffer, 0, bytesRead)
        memStream.Write(boundarybytes, 0, boundarybytes.Length)
&nbsp;
        httpWebRequest2.ContentLength = memStream.Length + 1
        <span style="color: #151B8D; font-weight: bold;">Dim</span> requestStream <span style="color: #151B8D; font-weight: bold;">As</span> Stream = httpWebRequest2.GetRequestStream()
        memStream.Position = 0
        <span style="color: #151B8D; font-weight: bold;">Dim</span> tempBuffer(memStream.Length) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Byte</span>
        memStream.Read(tempBuffer, 0, tempBuffer.Length)
        memStream.<span style="color: #8D38C9; font-weight: bold;">Close</span>()
        requestStream.Write(tempBuffer, 0, tempBuffer.Length)
        requestStream.<span style="color: #8D38C9; font-weight: bold;">Close</span>()
        <span style="color: #151B8D; font-weight: bold;">Dim</span> webResponse2 <span style="color: #151B8D; font-weight: bold;">As</span> WebResponse = httpWebRequest2.GetResponse()
        <span style="color: #151B8D; font-weight: bold;">Dim</span> stream2 <span style="color: #151B8D; font-weight: bold;">As</span> Stream = webResponse2.GetResponseStream()
        <span style="color: #151B8D; font-weight: bold;">Dim</span> reader2 <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #E56717; font-weight: bold;">New</span> StreamReader(stream2, Encoding.GetEncoding(1251))
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Res <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span> = reader2.ReadToEnd()
        webResponse2.<span style="color: #8D38C9; font-weight: bold;">Close</span>()
        Return Res
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span>
&nbsp;
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Function</span> Bmp2JpgUrl(<span style="color: #151B8D; font-weight: bold;">ByVal</span> LoadU <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>) <span style="color: #151B8D; font-weight: bold;">As</span> Stream
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Req <span style="color: #151B8D; font-weight: bold;">As</span> HttpWebRequest = CType(WebRequest.Create(LoadU), HttpWebRequest)
        Req.Method = <span style="color: #800000;">&quot;GET&quot;</span>
        Req.UserAgent = <span style="color: #800000;">&quot;Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0)&quot;</span>
        <span style="color: #151B8D; font-weight: bold;">Dim</span> resp <span style="color: #151B8D; font-weight: bold;">As</span> HttpWebResponse = CType(Req.GetResponse(), HttpWebResponse)
        <span style="color: #151B8D; font-weight: bold;">Dim</span> receiveStream <span style="color: #151B8D; font-weight: bold;">As</span> Stream = resp.GetResponseStream()
        <span style="color: #151B8D; font-weight: bold;">Dim</span> Bmp <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #E56717; font-weight: bold;">New</span> Bitmap(receiveStream)
        <span style="color: #151B8D; font-weight: bold;">Dim</span> ResStream <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #E56717; font-weight: bold;">New</span> MemoryStream()
        Bmp.Save(ResStream, ImageFormat.Jpeg)
        Return ResStream
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span></pre></div></div>

<p>Luego ya en el formulario lo siguiente será un botón y un picturebox para leer imagen, es solo un ejemplo, en donde la variable &#8220;<em>imgurl</em>&#8221; contiene la url completa de la imagen del captcha. Cuando se usa ReCaptcha por ejemplo, obtenemos una URL con un llave o código bastante extenso que representa a la imagen y es posible utilizarla.</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #151B8D; font-weight: bold;">Dim</span> imgurl <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
imgurl = <span style="color: #800000;">&quot;http://localhost/catpcha.jpg&quot;</span>
<span style="color: #151B8D; font-weight: bold;">Dim</span> anticaptcha <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #E56717; font-weight: bold;">New</span> agapi
anticaptcha.GetCaptcha(imgurl, <span style="color: #800000;">&quot;Aquí tu API KEY de Antigate&quot;</span>)
<span style="color: #151B8D; font-weight: bold;">Dim</span> txt <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>
txt = anticaptcha.GetCaptcha(imgurl, <span style="color: #800000;">&quot;Aquí tu API KEY de Antigate&quot;</span>)
TextBox1.Text = txt</pre></div></div>

<p>En donde la variable de tipo string llamada &#8220;txt&#8221; es la que nos devuelve el valor de la cadena ya resuelta.</p>
<p>La cuestión en este tipo de software es que debemos identificar la imagen de cada tipo de captcha, podemos trabajar los elementos HTML de la página e identificarlos con su elemento ID para obtener la URL de la imagen y así pasarla como parámetro a las funciones del <strong>api de Antigate</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://developeando.net/resolver-catpcha-vb-antigate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crear robots que interactuen con webs usando VB .NET (I)</title>
		<link>http://developeando.net/robots-web-visual-basic-i/</link>
		<comments>http://developeando.net/robots-web-visual-basic-i/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 03:31:18 +0000</pubDate>
		<dc:creator>Fabián Rodríguez</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[Visual Basic .NET]]></category>

		<guid isPermaLink="false">http://developeando.net/?p=542</guid>
		<description><![CDATA[Las finalidades que tiene el interactuar con una página web externa son bastantes y van en cada uno; ya sea extraer información o comunicarse con un servicio en la web son cosas que podemos hacer de varias formas en Visual Basic .NET. Para esta tarea no usaremos CURL (existen implementaciones para muchos lenguajes) más bien...]]></description>
				<content:encoded><![CDATA[<p>Las finalidades que tiene el interactuar con una página web externa son bastantes y van en cada uno; ya sea extraer información o comunicarse con un servicio en la web son cosas que podemos hacer de varias formas en <strong>Visual Basic .NET</strong>.</p>
<p>Para esta tarea no usaremos <strong>CURL</strong> (existen implementaciones para muchos lenguajes) más bien haremos uso del elemento WebBroser que proporciona la plataforma y adicionalmente se va a <em>interactuar con los elementos HTML</em> de la página, tal y como si estuviéramos usando JavaScript.</p>
<p>Para hacer el ejemplo más entendible construiremos nuestro propio formulario en PHP y lo ejecutaremos de forma local. El código con el que trabajaremos será este:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'registrar'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$nombre</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nombre'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pass</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Nombre: &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$nombre</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Password:&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$pass</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE&gt;
&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;form method=&quot;post&quot;&gt;
		&lt;label&gt;Ingresa tu nombre:&lt;/label&gt;&lt;br /&gt;
		&lt;input type=&quot;text&quot; name=&quot;nombre&quot; id=&quot;nombre&quot; /&gt;&lt;br /&gt;
&nbsp;
		&lt;label&gt;Ingre la contrase&amp;ntilde;a&lt;/label&gt;&lt;br /&gt;
		&lt;input type=&quot;text&quot; name=&quot;pass&quot; id=&quot;pass&quot; /&gt;
		&lt;br /&gt;
		&lt;input type=&quot;submit&quot; name=&quot;registrar&quot; id=&quot;registrar&quot; value=&quot;Registrarse&quot; /&gt;
	&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>El código lo que hace es capturar un nombre de usuario y una contraseña, y luego los muestra por pantalla. Un ejemplo muy simple pero servirá para nuestro propósito. Ahora, en <strong>Visual Basic .NET</strong> crearemos una interfaz como la siguiente agregando:</p>
<ul>
<li>2 Labels.</li>
<li>2 textbox.</li>
<li>1 control WebBrowser.</li>
<li>1 botón.</li>
</ul>
<p>La idea es que quede algo como esto:</p>
<p><img src="http://developeando.net/wp-content/uploads/2012/08/bot.png" alt="Bot simple en VB .NET" title="Bot en Visual Basic .NET" width="228" height="356" class="aligncenter size-full wp-image-553" /></p>
<p>Los controles textbox nos ayudarán a rellenar los dos campos del formulario en PHP que piden usuario y contraseña. Bien, para ello, en el evento Load cargaremos el fichero PHP y en el evento click de nuestro botón, las funciones que llenan automáticamente el formulario y lo procesan:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #E56717; font-weight: bold;">Public</span> Class Form1
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Button1_Click(<span style="color: #151B8D; font-weight: bold;">ByVal</span> sender <span style="color: #151B8D; font-weight: bold;">As</span> System.<span style="color: #F660AB; font-weight: bold;">Object</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> e <span style="color: #151B8D; font-weight: bold;">As</span> System.EventArgs) Handles Button1.Click
        WebBrowser1.Document.GetElementById(<span style="color: #800000;">&quot;nombre&quot;</span>).SetAttribute(<span style="color: #800000;">&quot;value&quot;</span>, TextBox1.Text)
        WebBrowser1.Document.GetElementById(<span style="color: #800000;">&quot;pass&quot;</span>).SetAttribute(<span style="color: #800000;">&quot;value&quot;</span>, TextBox2.Text)
        WebBrowser1.Document.GetElementById(<span style="color: #800000;">&quot;registrar&quot;</span>).InvokeMember(<span style="color: #800000;">&quot;click&quot;</span>)
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #E56717; font-weight: bold;">Private</span> <span style="color: #E56717; font-weight: bold;">Sub</span> Form1_Load(<span style="color: #151B8D; font-weight: bold;">ByVal</span> sender <span style="color: #151B8D; font-weight: bold;">As</span> System.<span style="color: #F660AB; font-weight: bold;">Object</span>, <span style="color: #151B8D; font-weight: bold;">ByVal</span> e <span style="color: #151B8D; font-weight: bold;">As</span> System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate(<span style="color: #800000;">&quot;http://localhost/ejemplo.php&quot;</span>)
    <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span>
<span style="color: #8D38C9; font-weight: bold;">End</span> Class</pre></div></div>

<p>Lo que hace el código, tal y como si estuviera trabajando con el <em>DOM de JavaScript</em>, es cargar la página en el navegador, luego, buscar a través de los elementos ID de nuestra página HTML y llenarlos con los campos que habíamos puesto en los textbox y por último a través del <strong>método SetAttribute</strong> cambiarle el valor, que es como se rellena el formulario.</p>
<p>Sin embargo, la última línea de código del evento click del botón no cambia ningún atributo, lo que hace es invocar a un miembro o evento predeterminado llamado &#8220;click&#8221; y con esto es como hace click (valga la redundancia) en el botón y la página procede a procesar los datos.</p>
<p><a href="http://www.mediafire.com/?y3q9gwa76f7pp96" title="Ejmplode Bots en Visual Basic .NET" rel="nofollow">Descargar los ficheros de ejemplo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://developeando.net/robots-web-visual-basic-i/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Crear un menú horizontal con listas usando CSS</title>
		<link>http://developeando.net/menu-horizontal-listas/</link>
		<comments>http://developeando.net/menu-horizontal-listas/#comments</comments>
		<pubDate>Mon, 28 May 2012 03:31:46 +0000</pubDate>
		<dc:creator>Fabián Rodríguez</dc:creator>
				<category><![CDATA[Programación]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://developeando.net/?p=526</guid>
		<description><![CDATA[La necesidad de crear menús horizontales se hace imprescindible a la hora de maquetar un sitio web, sobre todo si no se quieren utilizar tablas para ello. Y no es para menos, pues con las listas se puede maquetar fácilmente un menú y darle un estilo agradable con pocas líneas de código. El truco está...]]></description>
				<content:encoded><![CDATA[<p>La necesidad de <strong>crear menús horizontales</strong> se hace imprescindible a la hora de maquetar un sitio web, sobre todo si no se quieren utilizar tablas para ello. Y no es para menos, pues con las listas se puede maquetar fácilmente un menú y darle un estilo agradable con pocas líneas de código.</p>
<p>El truco está en la forma en el que se muestra cada item (elemento li) del menú, para ello hacemos uso de la propiedad de CSS &#8220;display&#8221;, quedando el código así:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">li <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Y el código HTML sería algo tan simple como esto:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;ul&gt;
	&lt;li&gt;Elemento 1&lt;/li&gt;
	&lt;li&gt;Elemento 2&lt;/li&gt;
	&lt;li&gt;Elemento 3&lt;/li&gt;
	&lt;li&gt;Elemento 4&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p>Gracias a esto, podemos hacer menús de un tono armonioso (para los que tienen una buena habilidad creativa) o hacer algo simple como el siguiente ejemplo (en donde también dejo el código fuente):</p>
<p><img src="http://developeando.net/wp-content/uploads/2012/05/menu-horizontal-css.png" alt="Crear menú horizontal con listas y CSS" title="Menú horizontal con CSS" width="385" height="40" class="aligncenter size-full wp-image-533" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;!DOCTYPE html<span style="color: #00AA00;">&gt;</span>
&lt;html<span style="color: #00AA00;">&gt;</span>
&lt;head<span style="color: #00AA00;">&gt;</span>
&lt;title<span style="color: #00AA00;">&gt;</span>Ejemplo de listas horizontales&lt;/title<span style="color: #00AA00;">&gt;</span>
&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
&nbsp;
<span style="color: #cc00cc;">#menu</span> li <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#menu</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#517a7d</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'Bookman Old Style'</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
	border-radius<span style="color: #00AA00;">:</span><span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #933;">0px</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
	opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0.7</span><span style="color: #00AA00;">;</span>
	-moz-opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0.7</span><span style="color: #00AA00;">;</span>
	filter<span style="color: #00AA00;">:</span>alpha<span style="color: #00AA00;">&#40;</span>opacity<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">7</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#menu</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">underline</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#197981</span><span style="color: #00AA00;">;</span>
	box-shadow<span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #933;">0px</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span>
&lt;/head<span style="color: #00AA00;">&gt;</span>
&lt;body<span style="color: #00AA00;">&gt;</span>
&lt;ul id<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;menu&quot;</span><span style="color: #00AA00;">&gt;</span>
	&lt;li<span style="color: #00AA00;">&gt;</span>&lt;a href<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #00AA00;">&gt;</span>Elemento <span style="color: #cc66cc;">1</span>&lt;/a<span style="color: #00AA00;">&gt;</span>&lt;/li<span style="color: #00AA00;">&gt;</span>
	&lt;li<span style="color: #00AA00;">&gt;</span>&lt;a href<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #00AA00;">&gt;</span>Elemento <span style="color: #cc66cc;">2</span>&lt;/a<span style="color: #00AA00;">&gt;</span>&lt;/li<span style="color: #00AA00;">&gt;</span>
	&lt;li<span style="color: #00AA00;">&gt;</span>&lt;a href<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #00AA00;">&gt;</span>Elemento <span style="color: #cc66cc;">3</span>&lt;/a<span style="color: #00AA00;">&gt;</span>&lt;/li<span style="color: #00AA00;">&gt;</span>
	&lt;li<span style="color: #00AA00;">&gt;</span>&lt;a href<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #00AA00;">&gt;</span>Elemento <span style="color: #cc66cc;">4</span>&lt;/a<span style="color: #00AA00;">&gt;</span>&lt;/li<span style="color: #00AA00;">&gt;</span>
&lt;/ul<span style="color: #00AA00;">&gt;</span>
&lt;/body<span style="color: #00AA00;">&gt;</span>
&lt;/html<span style="color: #00AA00;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://developeando.net/menu-horizontal-listas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tutorial Pygame VII: Manejo de fuentes y texto</title>
		<link>http://developeando.net/tutorial-pygame-fuentes-y-texto/</link>
		<comments>http://developeando.net/tutorial-pygame-fuentes-y-texto/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 00:48:02 +0000</pubDate>
		<dc:creator>Fabián Rodríguez</dc:creator>
				<category><![CDATA[Desarrollo de videojuegos]]></category>
		<category><![CDATA[Programación]]></category>
		<category><![CDATA[Pygame]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Videojuegos]]></category>

		<guid isPermaLink="false">http://developeando.net/?p=434</guid>
		<description><![CDATA[Con Pygame podemos escribir textos usando el módulo Font, podemos escribirlos de forma predeterminada con apenas algunas características o incluso cargar una fuente externa. Aquí por ejemplo en donde dice &#8220;None&#8221; podemos cambiar por una cadena que diga el directorio en donde se encuentra nuestro fichero del tipo de letra que queremos (la fuente .ttf)....]]></description>
				<content:encoded><![CDATA[<p>Con <strong>Pygame</strong> podemos escribir textos usando el <strong>módulo Font</strong>, podemos escribirlos de forma predeterminada con apenas algunas características o incluso <strong>cargar una fuente externa</strong>. Aquí por ejemplo en donde dice &#8220;None&#8221; podemos cambiar por una cadena que diga el directorio en donde se encuentra nuestro fichero del tipo de letra que queremos (la fuente .ttf).</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> pygame
<span style="color: #ff7700;font-weight:bold;">from</span> pygame.<span style="color: #008000;">locals</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
&nbsp;
pygame.<span style="color: black;">init</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
pantalla = pygame.<span style="color: black;">display</span>.<span style="color: black;">set_mode</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">450</span>,<span style="color: #ff4500;">300</span><span style="color: black;">&#41;</span>,<span style="color: #ff4500;">0</span>,<span style="color: #ff4500;">32</span><span style="color: black;">&#41;</span>
pygame.<span style="color: black;">display</span>.<span style="color: black;">set_caption</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Modulo de fuentes&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
reloj = pygame.<span style="color: #dc143c;">time</span>.<span style="color: black;">Clock</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
fuente = pygame.<span style="color: black;">font</span>.<span style="color: black;">Font</span><span style="color: black;">&#40;</span><span style="color: #008000;">None</span>, <span style="color: #ff4500;">30</span><span style="color: black;">&#41;</span>
texto1 = fuente.<span style="color: black;">render</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Texto de pruebas&quot;</span>, <span style="color: #ff4500;">0</span>, <span style="color: black;">&#40;</span><span style="color: #ff4500;">255</span>, <span style="color: #ff4500;">255</span>, <span style="color: #ff4500;">255</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:
    <span style="color: #ff7700;font-weight:bold;">for</span> event <span style="color: #ff7700;font-weight:bold;">in</span> pygame.<span style="color: black;">event</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> event.<span style="color: #008000;">type</span> == pygame.<span style="color: black;">QUIT</span>:
            exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    reloj.<span style="color: black;">tick</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">20</span><span style="color: black;">&#41;</span>
    pantalla.<span style="color: black;">blit</span><span style="color: black;">&#40;</span>texto1, <span style="color: black;">&#40;</span><span style="color: #ff4500;">100</span>,<span style="color: #ff4500;">100</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    pygame.<span style="color: black;">display</span>.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://developeando.net/tutorial-pygame-fuentes-y-texto/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
