Wu is back, Raekwon la boto para 2009. Me siento teenager…

http://www.411mania.com/music/album_reviews/115573

The 411: All the songs on Only Built 4 Cuban Linx II
are excellent songs in their own right, but for the purposes of making
the best album possible, some of them could have been saved for a later
project. To actually choose say, 3 or 4 songs to be left off is much
harder than it would normally be for an album of this length. Whilst
this may not be a Classic album in the same vein as Raekwon’s debut
album, it is certainly the album we have been waiting for from The Chef
and I have no doubt that this will be on many Year End lists as one of
the best releases of 2009.
411 Elite Award
Final Score:  9.5   

http://www.allmusic.com/cg/amg.dll?p=amg&sql=10:hzftxz9aldfe

If it looks long at 22 tracks, it’ll still leave the Wu
heads wanting more. This sequel may have little to do with the
original, but if the title helps to point out this is the Shaolin
poet’s best work since 1995’s Pt. 1, then so be it.

Ason Jones
http://www.youtube.com/watch?v=9zLv8_8mdZE

House of Flying Daggers

http://www.youtube.com/watch?v=nR7kVnh3PlI

Publicado en Entertainment | 3 comentarios

En que anda Rush, en espacios Semanticos y Lucidos

he estado metido de lleno en tecnologias de busquedas. Algunos enlaces para los fans:

  • SemanticMediaWiki: Extension de MediaWiki para crear un wiki semantico. Lo cool de esto es que permite crear queries y estos se pueden leer como JSON. Mejor que una base de datos solo que es wiki based. Seria interesante crear algo mas automatico / service based.
  • SIREn: Semantic Information Retrieval Engine para Lucene. Que mas puedo decir, lo de arriba pero usando Lucene como motor de indexamiento.
  • Solr / Lucene Payloads: Busqueda refinadas con Payloads.
  • Como crear ranking en Lucene
Publicado en Informática e Internet | 9 comentarios

Sobre articulo en La Prensa

  Aqui tienen un extracto y el enlace. Todavia opino lo mismo y voy mas aya, que podemos hacer otras cosas como FabLab en Panamá, que lo veo más interesante. Pero yo soy una persona futurista, posiblemente lo tengamos en algunos años.

"La compra de las laptop por el Gobierno para estudiantes graduandos, a
un costo de más de 10 millones de dólares, fue una inversión poco
rentable. Estas declaraciones fueron hechas por Rogelio Morrell
Caballero, de la empresa de consultoría tecnológica Admios S.A.,
afiliada a la Ciudad del Saber."

http://mensual.prensa.com/mensual/contenido/2009/05/26/hoy/panorama/1767290.asp

Saludos,
Rogelio

Publicado en Sin categoría | 10 comentarios

Microsoft y su HttpClient

http://www.pluralsight.com/community/blogs/aaron/archive/2009/03/13/consuming-the-twitter-rest-api-with-httpclient-wcf-rest-starter-kit.aspx

Me gusta cuando se inspiran en las cosas mias.

Pongo el código para que vean como utilizan internamente HttpRequest con Linq to XML

try
{
// initialize HttpClient for Twitter REST API
HttpClient http = new HttpClient("http://twitter.com/statuses/");
http.TransportSettings.Credentials =
new NetworkCredential(twitterUsername, twitterPassword);
HttpResponseMessage resp = null;

// retrieve Twitter friends timeline
resp = http.Get("friends_timeline.xml");
resp.EnsureStatusIsSuccessful();

// print all friends statuses
var statuses = resp.Content.ReadAsXElement().Descendants("status");
foreach (XElement status in statuses)
Console.WriteLine("{0}: {1}",
status.Element("user").Element("screen_name").Value,
status.Element("text").Value);

// update your Twitter status
string newStatus = "writing my first HttpClient app";
HttpUrlEncodedForm form = new HttpUrlEncodedForm();
form.Add("status", newStatus);
System.Net.ServicePointManager.Expect100Continue = false;
resp = http.Post("update.xml", form.CreateHttpContent());
resp.EnsureStatusIsSuccessful();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

Publicado en .NET | 10 comentarios

La nube o servicios de aplicativos por internet

Cloud Computing o como yo lo denoto Servicios de Aplicativos por
Internet (SAI), es la nueva tendencia que se esta viviendo en 2009.

Les puedo comentar mis experiencias con algunas de estas nuevas tecnologías.

Salesforce.com

Interesante:
Tiene un modelo de base de datos que mas se asemeja a Microsoft Access.
Tiene un lenguaje como JavaScript que se llama Apex y en realidad sirve
para ciertas cosas muy limitadas, pero al parecer se puede hacer cosas
como servicios web y triggers. Todo el esquema o modelo además se puede
acceder por servicios SOAP.

El diseño de Salesforce.com permite hospedar aplicaciones
Flash, Flex o Silverlight y permite que este sea un modelo "casi" ideal
para implementaciones de aplicaciones ricas de internet o RIA (Rich
Internet Applications).

Potencial:
Tiene un gran potencial porque ya tienen rato en el mercado y porque el
modelo tiene semejanzas a Microsoft Access, es decir, es fácil de
entender. Ahora no quiere decir que las relaciones por si sean Entidad
/ Relación en un 100%.

Desventajas:
El modelo de negocios es por subscripción, como el de todos los modelos de
Cloud Computing. El costo es igual para todos aunque no estoy seguro si
varía por región geográfica (una mensualidad que oscila entre 30 a 50 dolares). Otra desventaja es que Apex solo puede ser
ejecutado dentro de un trigger o un llamado de SOAP. Es decir, no puedo
tener un tipo de Job que ejecute Apex. Desventaja muy grande.

Amazon Web Services (AWS)

Interesante:
Tienen toda clase de servicios, pero los que mas interesan son ECS2
(Elastic Cloud Services), traducción es un sistema de virtualización de
sistemas operativos en Windows o Linux ; S3, el cual es un servicio de
almacenamiento de archivos y SimpleDB que es el servicio de base de
datos no relacional.

Potencial:
ECS2 tiene potencial para ciertos escenarios, el costo a mi todavía no
me llama la atención al menos que sea para ejecutar aplicaciones por
cierto intervalo de tiempo. Aun prefiero mi servidor barato con costo
de operación barato y que se pueda controlar. Me gusta la idea si de que
se puede tener varias instancias de la misma imagen (imaginate tener
Win2003 Data Center Edition con 400kb/s de internet downstream!) de un
robot web y que te almacene todo en SimpleDB. Esto es de maravilla en mi mundo de robots web que parsean la web.

Desventajas:
El modelo de subscripción puede ser costoso, aunque Amazon
recientemente esta
introduciendo un modelo de subscripción que se asemeja al de web
hosting (tarifa fija mensual). Por lo general, Amazon esta cobrando por
hora si es ECS2, por
ancho de banda y almacenamiento si es SimpleDB o S3.

Todavía me
falta evaluar Google App Engine  y Windows Azure. Este primero me costo
obtener la cuenta ya que solo es posible si estas en Estados Unidos (no
pregunte como hice, pero lo hice), y el otro es por invitación pero
Microsoft es abierto a esto.

Publicado en .NET | 5 comentarios

Ecyware WebRobot 1.0 – antecedentes

Estoy tomando las tecnologias en HttpLightClient y IELightClient y creando una herramienta inspirada en estos, que digamos son hermanos lejanos de GreenBlue Inspector.

La utilidad de esto es que los robots web necesitan estar lo mas cercano a Internet Explorer para ser exitosos. Esto quiere decir que necesitan la ayuda de Internet Explorer para navegar. Larga historia, pero les puedo sumarizar en que todavia no encuentro un motor JavaScript que no sea de un browser y sea opensource lo suficiente robusto e inteligente para que durante la ejecucción de un robot no me salga un popup preguntadome que quiero hacer.

Hasta ahi eso.

Estoy iniciando con un WPF usando un Frame y esto lo convierto a un WebBrowser pero el dia de ayer me encontre con la sorpresa de que me tiraba una cantidad de errores de JavaScript. Parece que hoy encontre la solución al problema.

(Todavia tengo que juntar mis ideas, pero el WebRobot va tener la opción de ejecutar scripts, habilitarlo para que sea visible o invisible, y por default debe tener un modelador de base de datos para guardar los datos del robot. Un flujo como: Robot Script -> Robot Runner -> Robot DataBase).

http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx

There is much functionality of the native Web Browser control
that our managed wrapper does not yet expose. The following code
snippet [prepared with Matt G.] shows how to get the IWebBrowser2
interface from the WPF WebBrowser control. This allows access to
methods on the object that are not publicly exposed in other ways for
the control. Do note, however, that this code sample will only work in
fully trusted code.

First, see IWebBrowser2 documentation here: http://msdn.microsoft.com/en-us/library/aa752127.aspx

To compile this code, add a COM Reference to System32shdocvw.dll or
ieframe.dll (whichever you have, depending on version of IE).

[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

[Guid("6d5140c1-7436-11ce-8034-00aa006009fa")]

internal interface IServiceProvider

{

[return: MarshalAs(UnmanagedType.IUnknown)]

object QueryService(ref Guid guidService, ref Guid riid);

}

static readonly Guid SID_SWebBrowserApp = new Guid("0002DF05-0000-0000-C000-000000000046");

IServiceProvider serviceProvider = (IServiceProvider)myWebBrowser.Document;

Guid serviceGuid = SID_SWebBrowserApp;

Guid iid = typeof(SHDocVw.IWebBrowser2).GUID;

SHDocVw.IWebBrowser2 myWebBrowser2 = (SHDocVw.IWebBrowser2) serviceProvider.QueryService(ref serviceGuid, ref iid);

And then myWebBrowser2 is ready for interaction.

You can also handle the native web browser’s events (http://msdn.microsoft.com/en-us/library/aa768309(VS.85).aspx) through the generated managed wrappers, like this:

SHDocVw.DWebBrowserEvents_Event wbEvents = (SHDocVw.DWebBrowserEvents_Event)myWebBrowser2;
wbEvents.NewWindow += new SHDocVw.DWebBrowserEvents_NewWindowEventHandler(OnWebBrowserNewWindow);

void OnWebBrowserNewWindow(string URL, int Flags, string
TargetFrameName, ref object PostData, string Headers, ref bool
Processed)
{
// Set Processed to cancel opening of the new window.
}

Publicado en .NET | 2 comentarios

CodeDOM sencillamente con Method Extensions

            // Class and namespace declaration
            CodeCompileUnit targetUnit = new CodeCompileUnit();

            CodeNamespace namespaceDeclaration = new CodeNamespace(NAMESPACE);
            namespaceDeclaration.Imports.Add(new CodeNamespaceImport("System"));
            namespaceDeclaration.Imports.Add(new CodeNamespaceImport("System.Runtime.InteropServices"));
            namespaceDeclaration.Imports.Add(new CodeNamespaceImport("Microsoft.Win32"));

            CodeTypeDeclaration targetClass =
              new CodeTypeDeclaration(CLASSNAME)
              {
                  IsClass = true,
                  TypeAttributes = TypeAttributes.Public,
                  IsPartial = true
              };

            namespaceDeclaration.Types.Add(targetClass);
            targetUnit.Namespaces.Add(namespaceDeclaration); 
           
            CodeAttributeDeclaration classInterfaceAttribute =
                new CodeAttributeDeclaration("System.Runtime.InteropServices.ClassInterfaceAttribute",
                    new CodeAttributeArgument(new CodePrimitiveExpression(ClassInterfaceType.AutoDual)));

            CodeAttributeDeclaration comVisibleAttribute =
                new CodeAttributeDeclaration("System.Runtime.InteropServices.ComVisibleAttribute",
                    new CodeAttributeArgument(new CodePrimitiveExpression(true)));

            CodeAttributeDeclaration guidAttribute =
                new CodeAttributeDeclaration("System.Runtime.InteropServices.GuidAttribute",
                    new CodeAttributeArgument(new CodePrimitiveExpression(Guid.NewGuid().ToString().ToUpper())));

            CodeAttributeDeclaration progIdAttribute =
                new CodeAttributeDeclaration("System.Runtime.InteropServices.ProgIdAttribute",
                    new CodeAttributeArgument(new CodePrimitiveExpression(PROGID)));
           

            // public static void RegisterFunction(Type type)           
            CreateMethod("System.Void", "RegisterFunction", MemberAttributes.Public | MemberAttributes.Static)
                .AddParameter("type", FieldDirection.In, "System.Type")
                .AddCodeSnippet("Registry.ClassesRoot.CreateSubKey(GetSubKeyName(type));")
                .AddMemberToClass(targetClass);           

            // public static void UnregisterFunction(Type type)
            CreateMethod("System.Void","UnregisterFunction", MemberAttributes.Public | MemberAttributes.Static)
                .AddParameter("type", FieldDirection.In, "System.Type")
                .AddCodeSnippet("Registry.ClassesRoot.DeleteSubKey(GetSubKeyName(type),false);")
                .AddMemberToClass(targetClass);

            // private static string GetSubKeyName(Type type)
            CreateMethod("System.String", "GetSubKeyName", MemberAttributes.Public | MemberAttributes.Static)
                .AddParameter("type", FieldDirection.In, "System.Type")
                .AddCodeSnippet(""CLSID\{" + type.GUID.ToString().ToUpper() + "}\Programmable";")
                .AddMemberToClass(targetClass);

            // public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
            CreateMethod("System.Void","OnConnection", MemberAttributes.Public)
                .AddParameter("Application", FieldDirection.In, "System.Object")
                .AddParameter("ConnectMode", FieldDirection.In, "Extensibility.ext_ConnectMode")
                .AddParameter("AddInInst", FieldDirection.In, "System.Object")
                .AddParameter("custom", FieldDirection.Ref, "System.Array")
                .AddCodeSnippet("mainApplication = Application as Application;")
                .AddMemberToClass(targetClass);

            // public void OnDisconnection(ext_DisconnectMode RemoveMode, ref Array custom)
            CreateMethod("System.Void", "OnDisconnection", MemberAttributes.Public)
                .AddParameter("RemoveMode", FieldDirection.In, "Extensibility.ext_DisconnectMode")
                .AddParameter("custom", FieldDirection.Ref, "System.Array")
                .AddCodeSnippet("mainApplication = null;")
                .AddMemberToClass(targetClass);

            // public void OnAddInsUpdate(ref Array custom)
            CreateMethod("System.Void", "OnAddInsUpdate", MemberAttributes.Public)
                .AddParameter("custom", FieldDirection.Ref, "System.Array")
                .AddMemberToClass(targetClass);

            // public void OnStartupComplete(ref Array custom)
            CreateMethod("System.Void", "OnStartupComplete", MemberAttributes.Public)
                .AddParameter("custom", FieldDirection.Ref, "System.Array")
                .AddMemberToClass(targetClass);

            // public void OnBeginShutdown(ref Array custom)
            CreateMethod("System.Void", "OnBeginShutdown", MemberAttributes.Public)
                .AddParameter("custom", FieldDirection.Ref, "System.Array")
                .AddMemberToClass(targetClass);

        }

        public CodeMemberMethod CreateMethod(string returnType,string name, MemberAttributes attributes)
        {
            CodeMemberMethod method =
                new CodeMemberMethod
                    {
                        Attributes = attributes,
                        Name = name,
                        ReturnType = new CodeTypeReference(returnType)
                    };

            return method;
        }
    }

    public static class CodeDomExtensions
    {
        public static CodeMemberMethod AddParameter(this CodeMemberMethod method, string name, FieldDirection direction, string parameterType)
        {
            method.Parameters.Add(
                new CodeParameterDeclarationExpression { Name = name, Direction = direction, Type = new CodeTypeReference(parameterType) });

            return method;
        }

        public static CodeMemberMethod AddCodeSnippet(this CodeMemberMethod method, string code)
        {
            method.Statements.Add(new CodeSnippetStatement(code));
            return method;
        }

        public static CodeMemberMethod AddMemberToClass(this CodeMemberMethod method, CodeTypeDeclaration addMemberToClass)
        {
            if (!addMemberToClass.Members.Contains(method))
            {
                addMemberToClass.Members.Add(method);
            }
            return method;
        }
    }

Publicado en .NET | 8 comentarios

HttpLightClient y IELightClient Open Source: Mis librerías de creación de robots web

HttpLightClient http://cid-300f1a82465dccda.skydrive.live.com/embedrowdetail.aspx/Public/HttpLightClient.rarIELightClient http://cid-300f1a82465dccda.skydrive.live.com/embedrowdetail.aspx/Public/IELightClient.rar

Brevemente, estas librerías son útiles para web scraping, web automation y también para todo lo que tiene que ver con web testing y web hacking (en términos de White hat).

Como usar HttpLightClient

La clase base en todo la librería se llama HttpWebClient, la cual define el cliente web a utilizar. HttpCommand es el comando o set de métodos para un protocolo o metodología en particular. En teoría, se podría heredar de HttpCommand (IHttpCommand) y crear comandos mas específicos. Es decir, si quisiéramos crear un SoapCommand para probar web services, o crear un SecurityCommand y agregar métodos para probar o hacking. SecurityCommand existe actualmente pero no se ha completado todavía.

Para iniciar HttpWebClient

HttpWebClient<HttpCommand> httpClient = new HttpWebClient<HttpCommand>();
httpClient.SetServicePointSettings(20, 100 * 1000, 10);
command = httpClient.CreateHttpCommand();
command.KeepAlive = true;

Donde configuramos SetServicePointSettings, esto es necesario para tener un buen rendimiento en los llamados web.

Al igual que System.Net.HttpWebRequest, podemos configurar otro conjunto de propiedades como KeepAlive.

Para obtener una página HTML en XML

XDocument page = command.GetDocumentForUrl(new HttpSettings { Query = supp.Link }, Preparser);

Donde el primer parámetro espera un HttpSettings, en este caso con el link, y el segundo parámetro es un delegate o función para pre parsear cualquier tipo de error que retorne la consulta (internamente usamos el famoso SgmlReader, por consiguiente es importante que el HTML sea parseable por SgmlReader).

Preparser ejemplo

public string Preparser(string data)
{
    data = data.Replace(@"<base href=http://www.ecyware.com>",string.Empty);
    data = data.Replace(@"<html xmlns=""http://www.w3.org/1999/xhtml"">","<html>");
    data = data.Replace(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">", string.Empty);
    int noscriptStart = data.IndexOf("<noscript>");
    int noscriptEnd = data.IndexOf("</noscript>",noscriptStart);
    data = data.Replace(data.Substring(noscriptStart, (noscriptEnd - noscriptStart) + 11), string.Empty); 

    do
    {
        int scriptStart = data.IndexOf("<script");
        int scriptEnd = data.IndexOf("</script>", scriptStart);
        data = data.Replace(data.Substring(scriptStart, (scriptEnd - scriptStart) + "<script>".Length + 1), string.Empty); 

    } while (data.IndexOf("<script>") > 0); 

    return data;
}

 

Como usar GetDocumentForUrl en un flujo de secuencias conocida

GetDocumentForUrl(indice, preparser, parametros), permite ingresar un indice de un flujo o pasos ya registrados. Para registrar un paso conocido, se agrega un HttpSettings a una lista, con un URL que puede contener parametros en formato String.

Ejemplo

// load links
steps.Add(
    new HttpSettings { QueryMask = http://www.ecyware.com/productos/{0}/{1}.html }
    );
steps.Add(
    new HttpSettings { QueryMask = "{0}/information.html" }
    );
steps.Add(
    new HttpSettings { QueryMask = "{0}/other_information.html" }
    );
steps.Add(
    new HttpSettings { QueryMask = "{0}/listado.html?pagina={1}" }
    );  
command.RegisterSteps(steps);

Ejemplo con IELightClient

string login = "http://www.ecyware.com/auth";
            
            var document = ieClient.GetDocument(login);
            document.GetInputElement("ctl00_PageContent_Login1_UserName").value = "username";
            document.GetInputElement("ctl00_PageContent_Login1_Password").value = "123456";
            document.GetInputElement("ctl00_PageContent_Login1_CheckboxRememberMe").value = "on";
            document.GetInputElement("ctl00_PageContent_Login1_UserName").value = "username";
// Aqui hacemos un HTTP POST
            ieClient.SubmitFromButton(document, "ctl00_PageContent_Login1_Button"); 

            string redir = "http://www.ecyware.com/Authenticated.aspx?login=zn89s,s090&M";            
            string html = ieClient.GetHtml(redir);

            document.close();
            document = null;
            // logged in

Diferentes formas de parsear contenido con IELightClient y HttpLightClient

// Obtiene un XDocument dado un Url y un Preparse delegate
XDocument mainDocument = ieClient.GetXDocumentForUrl(settings.Query, Preparse);

// Obtiene un XDocument usando TryParseToXml de un HttpCommand
                XDocument postBackDocument = new XDocument();
                command.TryParseToXml(Preparse(ppiDocument.body.outerHTML), out postBackDocument);   

Publicado en .NET | 8 comentarios

Leyendo sobre R, salte a F#, se me ocurrio crear un open source university project y encontre

Esto
Disfruten, 10 years ago..
 
 
Publicado en Personal | 4 comentarios

Guias de Arquitectura de RIA, Servicios y Agile

Excelente lectura, en especial la de RIA Architecture y Agile Architecture…

http://www.codeplex.com/AppArch/Wiki/View.aspx?title=Downloads&referringTitle=Home

Pocket Guides

Subsets of content from the Main Guide with minor rework to keep it relevant to a particular topic.

Videos

Powerpoint Slides

Publicado en Sin categoría | 4 comentarios