Tuesday, 27 February 2007

How to manufacture a celebrity...

Have you ever wondered how these beautiful girls and boys appear suddenly on your TV, singing a completely meaningless song while looking like they're having the time of their life? And how they seem to overwhelm the TV, then the radio, then appear in tabloids, then completely disappear? Where is a small tutorial on how to make your own!


The clip is from a movie called Before the Music Dies (or B4MD, how they chose to shortcut it) that exposes the bad things in the music industry today. Here is the link to the IMDb entry for the movie. I will see it as soon as I can and review it, then update this post.

Sunday, 25 February 2007

Statistical discrimination

Yes, at last another one of the World Sucks series. Here I am tackling globalisation, yet not the concept, but the buzz. People that somehow are against globalisation are the ones that have actually already accepted defeat. They see the franchise epidemic and high level political and economic games as the cause, not the symptom. They are nothing but fork and torch villagers trying to kill the beast without really understanding the cause of everything. They are especially wrong since they try to kill a beast much stronger than they will ever be.

And the cause is... not dr. Frankenstein, but statistical discrimination. It is the thing that makes shops disappear if they don't give to most of the people most of what they want, that puts people that don't behave like the majority into ignorable categories, the thing that doesn't come from high up to affect us, little people, but comes from very little people to affect the higher ups.

I am talking about statistics. Once you have enough objective data you can draw conclusions based on hard mathematics, conclusions that you know are not biased and that have true meaning. It tells shop chains which are the most financially effective customers and what exactly choose to buy, it tells media conglomerates which are the people which will be most inclined to see their shows, exactly what they would want to watch and how much they are going to be influenced by commercials in order to buy products, it tells politicians which is the biggest part of the electorate and what they could be told in order to elect them.

The effect of this is statistical discrimination, or the oppression of the minority groups that don't "fit" into the whole data schema. That's why you will not get the products you really want, you will not see the shows you want to see or the movies you crave or the books you need. That's why you will see young people asking you about every day things like some vegetables you used to find when you were a child and now nobody knows what they are. They do know about some exotic fruit you've never heard about, too, and they are willing to pay ten times the price of normal fruit for the privilege to eat it.

It starts with small business, it extends to media, then to art, then to politics. Before you know it, you can either do what everyone else does or be ignored. Does it sound like 1984? That was a naive view of the world, where the actual oppressors were a very small minority, where democracy was a dream. No, the actual oppression comes from the majority of people, the idiots watching today's TV shows, eating popcorn at European Gigolo and Scooby Doo the Movie. And it all starts from you, the little people.

Every form of discrimination in this world, either good or bad (yes, there is good discrimination), is statistical in nature, but most bad ones are determined by bad entry data, like all Gypsies are dirty or all black people are thieves. This time there is a growing mother-of-all discrimination, one that starts with perfect data, ends up with the perfect solution and leaves just about everyone that matters out of it.

The only option IS globalisation, the only possible solution for the people that want to do something different is to get together, through the Internet, through the disappearance of borders, nationalities and local law, through the dismissal of all things that separate people of the same type, because the oldest and most effective method of ruling other people is divide-and-conquer. Because no one is special for being American or Romanian, these are just stupid inventions, based on geography or past connections. Each person is special for their own reasons.

Globalisation is not the cause, it is the symptom. It is the opposite of localisation, or keeping something for yourself in a single place. Globalisation is the crucible of sense: you now get to decide what is important and what not in the whole world! And the problem is not high up, it's down with you, it's your decision.

Fight stupidity; elect common sense; choose diversity; create AND consume what others create just don't limit yourself to consumption alone; say the things you mean, not the things others want to hear; fight for your right to party, but think of the people who want to sleep; do what you like, but consider the others.

Blame it on Nihei Tsutomu!

Blame! cover imageYes, Manga again. I feel the whole manga/anime intensity fading away again, since I've read the Berserk and InuYasha manga and watched the Samurai Deeper Kyo anime series. Oh... that and my wife hates me for ignoring her :)
But before this manga fading to black, I will blog one more manga series. I think that it is nicely drawn, but hard to actually follow. I am talking about hardcore sci-fi manga Blame! by Nihei Tsutomu. Placed in a distant future, humans and silicon creatures (and some crossbreeds) inhabit a huge structure and fight each other for obscure reasons. The manga is a cross between Giger and Aeon Flux and, if you remember the MTV show, just as hard to follow due to very little explaining and scarce dialogue. It is basically a world description, even if it has a central character and a plot line.
The same artist created two other manga series in the same universe: Biomega and Net Sphere Engineer. You can download most of the Nihei Tsutomu works at the Controlling Authority site.

Thursday, 22 February 2007

Wednesday, 21 February 2007

duteVino, an interesting Romanian Alternative/Funk band

Update: their official site is not valid anymore and there hasn't been activity on their myspace page hasn't been changed from mid 2006.

A while ago I got this song from a friend of mine, it was called gruv.mp3. No id tag, nothing about the origin of the song. I thought it was nice, but it bothered me that I didn't know who the hell sang it and, of course, where I should get more. Finally, after searching for the lyrics on Google every one month or so, I finally found out who the band was.

They are called duteVino and they are from Romania, mind you. They are singing in English, though, and there is almost no accent whatsoever. The genre of their songs is something like Alternative/Funk/Jazz. Visit their myspace site to get a feel for their music.

Tuesday, 20 February 2007

A little pop rock from Finnish band LAB

How about some pop-rock music for a change? Of course I am depressed all the time if I only listen to sad music. Here is a nice, pop, rock, sexy, jiggly song from a Finnish band called LAB (their official site at labplanet.net is down, the band is disbanded): Beat the Boys



If you liked this, you might want to check two other LAB videos: Machine Girl and When Heaven Gets Dirty
Update:
I've gotten all their songs and they rock! This band is like a better Garbage! Original and strong. I just love their songs.

Update:
It's so difficult to find the band members without knowing more than Ana's first name and Pekka "Splendid" Laine having quite a common name. It doesn't help that they are Finnish, either. The story, as far as I can ascertain is that the members split up and went their separate way. Ana and Splendid worked on an album together that was supposedly finished in 2009, but was never released. Their new band is not called LAB anymore, but "Rain Hill", another commonly found name on the Internet, although not as bad as Lab, I guess. Their band page shows activity in early 2013 and even two songs that I cannot find anywhere for free, but their previews are pretty cool. It smells like another failed project. That is so bad.

Anyway, the links to the new band's Facebook page is this and the link to their official (and horrible) web site is this, where you can also listen to two 30 second previews.

Monday, 19 February 2007

ASP.Net Ajax and Response.Write or response filters The message received from the server could not be parsed.

Update: If you've experienced random PageRequestManagerParserErrorException errors that seem to vanish at a simple page refresh, read this post instead: An intermittent PageRequestManagerParserErrorException

I've built a TranslationFilter object that tries to.. well... translate ASP.Net pages. Everything ran smoothly until I had to use ASP.Net Ajax. I got the infamous error "Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.".

Starting analysing the problem, I soon understood that the Ajax requests go through the same Response mechanism as a normal page request, but the output is different. In case of normal page requests you get the HTML of the page, while in Ajax requests you get something formated like this:
contentLength|controlType|controlID|content|


If one uses Response.Write, the text is inserted both in the page HTML and the Ajax request format, resulting in something like "blablabla10|updatePanel|UpdatePanel1|0123456789" which cannot be parsed correctly and results in an error. The ScriptManager.IsInAsyncPostBack property shows us if the request is Ajax or not, so we can condition the Response.Write on this.

Also, if changing the content with a HttpResponse.Filter, the length of the content is no longer equal with the declared value. So what must be done is first detect if the content is Ajax. Unfortunately we cannot check the state of the ScriptManager from inside the HttpResponse.Filter, but we can check the format of the string to modify, then modify the content AND the contentLength, else it will all result in error.

Update: the content might not be changed by you! As one of the people asking me for help on the chat discovered, the web server provider might want to put in some ads, regardless if the request is an Ajax one, thus breaking the format. You need to patch the javascript ajax engine in order to work, that means changing the content the javascript function will get in order to not cause errors. You may find the solution here.

As an example, here is my Translate method:
        private string RecursiveTranslateAjax(string content)
        {
            Regex reg = new Regex(@"^(\d+)\|[^\|]*\|[^\|]*\|",
                         RegexOptions.Singleline);
            Match m = reg.Match(content);
            if (m.Success)
            {
                int length = To.Int(m.Groups[1]);
                reg = new Regex(
                         @"^(\d+)(\|[^\|]*\|[^\|]*\|)(.{" + length + @"})\|"
                         , RegexOptions.Singleline);
                m = reg.Match(content);
                if (m.Success)
                {
                    string trans = Translate(m.Groups[3].Value);
                    return trans.Length + m.Groups[2].Value 
                       + trans + "|"
                       + RecursiveTranslateAjax(content.Substring(m.Length));
                }
            }
            return Translate(content);
        }


Update:
I met this problem also when in the page there were Unicode characters. Everything works perfectly, then you can't postback anything, because some user text contains Unicode chars. The solution I used for this was to get the offending text (whether in Page.Render or in some other places based on specific situations) and take every character and check if it is ASCII. Web Pages should be UTF8 so any character bigger than 127 should be translated into a web page Unicode char &#[char code];

The code:

string s=[my string]
StringBuilder sb=new StringBuilder();
for (int c=0; c<s.Length; c++)
{
if (s[c]>127) sb.Append("&#"+((int)s[c])+";");
else sb.Append(s[c]);
}
s=sb.ToString();


Here is the full code
    private string RecursiveTranslateAjax(string content)
    {
        // look for the basic Ajax response syntax
        Regex reg = new Regex(@"^(\d+)\|[^\|]*\|[^\|]*\|", 
              RegexOptions.Singleline);
        Match m = reg.Match(content);
        // if found, search deeper, by taking 
        // into account the length of the html text
        if (m.Success)
        {
            // custom method to get an integer value
            int length = To.Int(m.Groups[1]); 
            reg = new Regex(@"^(\d+)(\|[^\|]*\|[^\|]*\|)(.{" + length + @"})\|",
                  RegexOptions.Singleline);
            m = reg.Match(content);
            if (m.Success)
            {
                string trans = Translate(m.Groups[3].Value);
                return
                    trans.Length + m.Groups[2].Value + 
                    trans + "|" + 
                    RecursiveTranslateAjax(content.Substring(m.Length));
            }
        }
        // if not Ajax, just translate everything,
        // it must be a normal PostBack or a string of some sort.
        return Translate(content);
    }
 
    // this method only fixes the weird characters
    // but you can put here any string change you would like
    // like search and replace some words.
    private string Translate(string content)
    {
        // Html code all chars that are not ASCII, thus getting rid of strange or Unicode characters
        StringBuilder sb = new StringBuilder();
        for (int c = 0; c < content.Length; c++)
        {
            if (content[c] > 127) sb.Append("&#" + ((int) content[c]) + ";");
            else sb.Append(content[c]);
        }
        return sb.ToString();
    }
 
    protected override void Render(HtmlTextWriter writer)
    {
        //base.Render(writer);
        // render to my own text writer
        HtmlTextWriter tw=new HtmlTextWriter(new StringWriter());
        base.Render(tw);
        // get the Rendered content of the page
        string content = tw.InnerWriter.ToString();
        content = RecursiveTranslateAjax(content);
        writer.Write(content);
    }


To.Int method
public static int Int(object o)
{
    if (o == null) return 0;
    if (IsNumericVariable(o)) return (int) CastDouble(o);
    string s = o.ToString();
    if (s == "") return 0;
    Match m = Regex.Match(s, "(-\\d+|\\d+)");
    if (m.Success)
        try
        {
            return Int32.Parse(m.Groups[0].Value);
        }
        catch
        {
        }
    return 0;
}
private static double CastDouble(object o)
{
    if (o is byte) return (byte) o;
    if (o is int) return (int) o;
    if (o is long) return (long) o;
    if (o is float) return (float) o;
    if (o is double) return (double) o;
    if (o is decimal) return (double) (decimal) o;
    throw new ArgumentException("Type is not convertable to double: " + o.GetType().FullName);
}