Blog de Francisco Velázquez

otro blog personal

Evitar el adtracking

leave a comment »

A través de este interesante artículo descubro una nueva herramienta: Disconnect para evitar el adtracking, que ya podíamos ver a través de Collusion de Mozilla. Yo hasta ahora usaba el plugin DoNotTrackMe. Sin embargo he descubierto que puedo tenerlo todo con añadir la lista EasyPrivacy a AdBlockPlus.

Written by fravelgue

April 20, 2013 at 7:11 pm

Posted in advertising

Tagged with ,

El futuro con Firefox y Opera es mejor

leave a comment »

El MWC nos esta trayendo una buena cantidad de noticias, para mi una de las más importantes es la evolución de FirefoxOS y su repercusión en la mobile web. Parece que por fin vamos a disponer de las deseadas WebAPIs.

Y mi deseo es que con Opera adoptando WebKit se acelere la inclusión de estas funcionalidades en los navegadores mayoritarios: Android e iOs.

En definitiva esperemos que el futuro sea aún mejor :-)

Written by fravelgue

March 8, 2013 at 7:42 am

Posted in business, mobile web

Cómo hacer dinero en internet?

leave a comment »

via.

Written by fravelgue

October 15, 2012 at 6:12 pm

Posted in business

Exportar a csv desde c#

leave a comment »

Una pequeña utilidad para exportar listas genéricas a csv, usando expresiones lambda.

public class ExportExcel<T> where T : class
    {
        private StringBuilder sb;        

        public ExportExcel()
        {            
            sb = new StringBuilder();
            if (HttpContext.Current != null)
                Context = HttpContext.Current;
        }

        public string Filename { get; set; }
        public HttpContext Context { get; set; }

        public void Export(List<T> l, Expression<Func<T, object>> expression)
        {
            if (string.IsNullOrEmpty(Filename))
                return;

            build(l, expression);

            Context.Response.AddHeader("content-disposition", "attachment;filename=" + Filename);
            Context.Response.Charset = string.Empty;
            Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Context.Response.ContentType = "application/CSV";            
            Context.Response.Write(sb.ToString());
            Context.Response.End();
        }

        public string ToString(List<T> l, Expression<Func<T, object>> expression)
        {            
            build(l, expression);
            return sb.ToString();
        }

        private void build(List<T> l, Expression<Func<T, object>> expression)
        {
            sb = new StringBuilder();
            List<string> propertiesName = new List<string>();
            NewArrayExpression array = expression.Body as NewArrayExpression;
            foreach (object obj in (IEnumerable<object>)(array.Expressions))
            {
                string propertyName = obj.ToString().Remove(0, obj.ToString().IndexOf(".") + 1);
                propertyName = propertyName.Replace(")", "");
                sb.Append(propertyName + ";");
                propertiesName.Add(propertyName);
            }
            sb.AppendLine();

            foreach (var i in l)
            {
                foreach (var propertyName in propertiesName)
                {
                    sb.Append(getPropertyValue(i, propertyName).ToString() + ";");
                }
                sb.AppendLine();
            }
        }

        internal static object getPropertyValue(object obj, string propertyName)
        {
            const System.Reflection.BindingFlags bindingFlags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance;

            var pi = typeof(T).GetProperties(bindingFlags).Where(prop => prop.Name == propertyName).SingleOrDefault();
            return pi.GetValue(obj, null);
        }
    }

Written by fravelgue

September 27, 2012 at 7:36 pm

Posted in .net

Tagged with , ,

Recomendación para nueva app web

leave a comment »

One of my favorite business model suggestions for [web] entrepreneurs is to find an old UNIX command that hasn’t yet been implemented on the web, and fix that.

via.

Written by fravelgue

June 1, 2012 at 6:14 pm

Posted in development

Tagged with ,

QueryString Helper

leave a comment »

Muy a menudo tengo que consultar los valores de las QueryStrings, y la verdad es que es horrible el montón de comprobaciones que hay que hacer. Además muchas veces, wap proxies o adsevers incluyen caracteres en la querystring, haciendo que los parsers lancen excepciones.

public static class Extensions
{
private static readonly Regex LeadingInteger = new Regex(@"^(-?\d+)");

public static T Get<T>(this System.Collections.Specialized.NameValueCollection nvc, string key)
where T : IConvertible
{
T obj = default(T);

if (nvc == null || string.IsNullOrEmpty(nvc[key]))
return default(T);

string v = nvc[key];

if (typeof(T) == typeof(Guid))
v = v.Substring(0, 36);

if (typeof(T) == typeof(int))
{   //http://stackoverflow.com/a/975512/22055
Match match = LeadingInteger.Match(v);
if (!match.Success)
v = match.Value;
else
return default(T);
}

try
{
obj = (T)Convert.ChangeType(v, typeof(T));
}
catch { }
return obj;
}
}

A veces, echo de menos las facilidades de lenguajes dinámicos como JS, por ejemplo, en el parseInt

Written by fravelgue

May 24, 2012 at 6:41 pm

Posted in development

Tagged with , ,

Problemas para acceder a bbva.es desde Firefox

leave a comment »

Si al acceder a bbva.es desde Firefox tienes un problema en el que se te informa que tu sesión ha expirado, prueba a desactivar algunos de los complementos que uses, en mi caso fue Do Not Track Plus (DNT+).

Written by fravelgue

May 12, 2012 at 9:22 am

Posted in util

Tagged with , ,

Follow

Get every new post delivered to your Inbox.