Boxee Plugin for i-vysílání České televize (Czech TV)

Published by Tomas  Vitvar on March 3, 2011 in Programming,Tools

The Czech TV has a great amount of TV shows available on the Web called i-vysílání. Not only you can watch the life TV over the Web but you can also watch most of the TV shows including news, documentaries, or sports over 5 years back. Accessing TV content through Web browsers where you need to do a sequence of clicks through pages full of flash is not very convenient though. This makes the TV experience pretty bad and you often rather do not open the browser to watch the TV. Fortunately, there are technologies such as Boxee.

Boxee is a media center based on XMBC media center with plugin architecture for custom apps. The embedded video below shows such an app for the Czech TV’s iVysilani.

Exclude Self-traffic from your Website’s Access Reports

Published by Tomas  Vitvar on January 13, 2009 in Ideas,Programming

I use Google Analytics to track my website’s traffic. Since I also often use information on my website to quickly search for a paper I wrote and refer to it, I access my website quite often. From this reason I need to exclude my own traffic from reports generated by Goolge Analytics. Google Analytics comes with two suggestions how to do this, however, neither of them is really suitable for me. The first option is to exclude all traffic based on one or more IPs. I can set a filter to exclude a traffic from my work as well as home networks, however, I do not really want to exclude a traffic from my colleagues which such a filter would do too (my work place has a single public IP shared by all outgoing connections). The other option is to set a variable (cookie) on all pages you want to exclude and create a filter based on that variable. This option is not any better as I would need to always set such variable on every new page I create, that is, call a specific javascript method when page loads, deploy the page to my web server, access the page to set the cookie for my own access, and then remove the javascript method call and redeploy the new page for public access.

Fortunately, a very simple solution came into my mind (currently only works on Firefox). First, I create a custom variable in the Firefox configuration settings called general.useragent.extra.private and set its value to my_agent” (please use your own unique identification, type about:config in your browser’s address bar to create and set such variable). This will add the “my_agent” string to the browser’s agent identification that you can read from within the javascript in the browser by userAgent property of the navigator object (navigator.userAgent). After that you can just add a simple condition to your page’s javascript code that calls Google Analytics methods to track your page’s traffic. The script could look like:

<script type="text/javascript">
    if (navigator.userAgent.indexOf('my_agent') == -1) {
        var pageTracker = _gat._getTracker("UA-xxx");
        pageTracker._trackPageview();
    }
</script>
Update: In Safari, you can set a custom user agent string by enabling Develop menu (goto "Preferences->Advanced->Show Develop Menu in Menu Bar") and in the develop menu "User Agent->Other..." set the user agent string.    

New Version of my Website

Published by Tomas  Vitvar on April 25, 2008 in Personal,Programming

I have recently updated my website with some new features. First of all, I have migrated the whole website to a new location and at the same time I have rewritten its source in the language and using the tool called Konamara which I develop for website content management and publishing (there is currently two websites maintained by Konamara, my personal one and the CMS WG website).

Following are the new features of the website:

  • WordPress blog is fully and seamlessly integrated with website look with recent blog posts displayed on the entry page.
  • Events which I maintain separately in the Google calendar are displayed on the website. Whenever the new event appears in the calendar, the list of events is updated on the website.
  • Integrated Google search engine using Google AJAX Search API to search the content of my website.
  • List of my publications and presentations is generated from the XML of all my publications. Konamara can easily generate selected publications (those with higher rank) and all publications on separate tabs.
  • Some AJAX features such as tabs for “selected” and “all” publications.

The major driver behind Konamara is to allow ease of use of website development powered by Web 2.0 features such as rich user experience, service mashups, etc. I also plan to use it as a basis for semantic service mashups and incorporate some of the ongoing work in semantic web services. I will provide some more details about Konamara later in my blog.

Mashing-up with Google Translator

Published by Tomas  Vitvar on October 10, 2007 in Programming

Have you ever though about your website or blog to be in multiple languages? Although the language that most people speak is English there might be people who would like to read your web in Russian or Chinese.

Google (as well as some others) provide language tools allowing to translate any text or a website in a particular language to a number of other languages. However, if you want to make your site directly multilingual using these tools, you want to put the translate links directly to your website and customize the translation parameters. This is not as straightforward as one would expect. Also, when you supply the URL to the Google translator you get the entirely browsable website in the other language, however, there is always this annoying banner on the top of each page: “this page was automatically translated from…”. If you want to see how this works for my website, just go to the bottom of this page and clink on one of the flag images.

For example, for a website in English the following code enables the German language link where you place it.
<form action="http://www.google.com/translate_p">
  <script language="javascript">
     var u = location.href;
     var r = new.RegExp("u=(.*)", "");
     if (r.test(location.href)) {
        r = r.exec(location.href);
        u = RegExp.$1;
     }
     document.write ("<input name='u' value="+u+"
        type='hidden'>")
  </script>
  <input name="hl" type="hidden" value="en">
  <input name="ie" type="hidden" value="UTF8">
  <input name="langpair" type="hidden" value="">   

  <!- language links from English to other languages ->
  <input id="flag" name="langpair" 
     onclick="this.form.langpair.value=this.value"
     src="url/to/german/image/flag" 
     title="German" 
     type="image"
     value="en|de">
  <!--- other language links go here --->
</form>

To place other language links just add other input elements with id “flag” and change src attribute for the image of the flag, title for the language name, and value in a form “en|lang” where lang is the language code (“de” for German, “it” for Italian, “es” for Spanish and so on).

The reason why you need to use the JavaScript code is that when you click the German language link and the page is translated, you get the new page URL as something like

http://66.249.91.104/translate_c?hl=en
&langpair=en%7Cde&u=http://mywebsite.com/

When the page is loaded the script extracts the real URL of your page and creates a parameter with name “u” with the value of proper URL of your page. This is necessary for subsequent clicks on the language links so that the real URL of your page is passed to the Google translator.

The only problem remains with the translation itself. The Google translator translates everything which appears in the page. It would be very handy if the translation tool recognizes some special markup preserving the original text in the original language (such as names).

Blog

Archive