<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Advogato blog for Kay</title>
    <link>http://www.advogato.org/person/Kay/</link>
    <description>Advogato blog for Kay</description>
    <language>en-us</language>
    <generator>mod_virgule</generator>
    <pubDate>Thu, 20 Jun 2013 03:12:04 GMT</pubDate>
    <item>
      <pubDate>Mon, 31 Dec 2012 12:15:43 GMT</pubDate>
      <title>JavaScript Cookie Check</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=80</link>
      <guid>http://www.ailis.de/~k/archives/74-JavaScript-Cookie-Check.html</guid>
      <description>&lt;p&gt;
It's strange to see that today in 2012 browser cookies are still making trouble. It shouldn't be that difficult to check with JavaScript if cookies are enabled in the browser. The non-standard &lt;code&gt;navigator.cookieEnabled&lt;/code&gt; flag works correctly in Chrome, Firefox, Opera and Safari but Internet Explorer is simply lying to us! It supports this flag (It's not &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;) but it is always set to &lt;code&gt;true&lt;/code&gt;! So we still need hacks for this browser. It's also strange that I wasn't able to find a working hack on the Internet. So I wrote my own:
&lt;/p&gt;
&lt;pre&gt;
/**
 * Checks if browser supports cookies.
 * 
 * @return {boolean}
 *             True if browser supports cookies, false if not.
 */
function supportsCookies()
{
    var cookieEnabled = navigator.cookieEnabled;
    
    // When cookieEnabled flag is present and false then cookies are disabled.
    // Thanks to IE we can't trust the value "true".
    if (cookieEnabled === false) return false;

    // Internet Explorer is lying to us. So we have to set a test cookie
    // in this browser (We also do it for strange browsers not supporting
    // the cookieEnabled flag). But we only do this when no cookies are
    // already set (because that would mean cookies are enabled)
    if (!document.cookie &amp;amp;&amp;amp; (cookieEnabled == null || /*@cc_on!@*/false))
    {
        // Try to set a test cookie. If not set then cookies are disabled
        document.cookie = "testcookie=1";
        if (!document.cookie) return false;
        
        // Remove test cookie
        document.cookie = "testcookie=; expires=" + new Date(0).toUTCString();
    }

    // Well, at least we couldn't find out if cookies are disabled, so we
    // assume they are enabled
    return true;
};
&lt;/pre&gt;

&lt;p&gt;
Let's explain what this code is doing:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;When the &lt;code&gt;navigator.cookiesEnabled&lt;/code&gt; flag is present and is &lt;code&gt;false&lt;/code&gt; then we definitely know that cookies are disabled. All major browsers except Internet Explorer will stop right here when cookies are blocked.&lt;/li&gt;
&lt;li&gt;When &lt;code&gt;navigator.cookiesEnabled&lt;/code&gt; flag is not present (maybe some really old browser) or when Internet Explorer is deteced (Checked with JScript conditional compilation) then a test cookie is set. But we only do this when there are no cookies already set (Because when there is already a cookie then cookies can't be disabled). When our test cookie can be read again then cookies are enabled, otherwise they are disabled.
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
The code works in IE7-10, Firefox 17, Chrome 23, Opera 12 and Safari 6.
&lt;/p&gt;
&lt;p&gt;
What a shame that code like this is still needed in 2012...
&lt;/p&gt;</description>
    </item>
    <item>
      <pubDate>Thu, 13 Dec 2012 18:07:14 GMT</pubDate>
      <title>Netscape Navigator 4 on Ubuntu Linux 12.10</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=79</link>
      <guid>http://www.ailis.de/~k/archives/75-Netscape-Navigator-4-on-Ubuntu-Linux-12.10.html</guid>
      <description>&lt;p&gt;
Feeling nostalgic? Or masochistic? Or are you a real professional and you want to make sure your website even works when it leaks through the time vortex into the year 1998? Then you definitely want to install Netscape 4 on your shiny new Ubuntu 12.10, won't you?
&lt;/p&gt;
&lt;p&gt;
&lt;!-- s9ymdb:434 --&gt;&lt;img class="serendipity_image_center" width="768" height="432" src="http://www.ailis.de/~k/uploads/netscape1.png" alt=""/&gt;&lt;/p&gt;
&lt;p&gt;
Well, it's a little bit tricky but let me help you.
&lt;/p&gt; &lt;br/&gt;&lt;a href="http://www.ailis.de/~k/archives/75-Netscape-Navigator-4-on-Ubuntu-Linux-12.10.html#extended" &gt;Continue reading "Netscape Navigator 4 on Ubuntu Linux 12.10"&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 30 Sep 2012 23:09:40 GMT</pubDate>
      <title>Minecraft and Gnome Shell</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=78</link>
      <guid>http://www.ailis.de/~k/archives/73-Minecraft-and-Gnome-Shell.html</guid>
      <description>&lt;p&gt;
If you are running &lt;a href="http://www.minecraft.net/" &gt;Minecraft&lt;/a&gt; on Linux with &lt;a href="http://www.gnome.org/" &gt;Gnome 3&lt;/a&gt; then you might have noticed that it doesn't integrate well into Gnome Shell as you can see in these screenshots:
&lt;/p&gt;
&lt;p&gt;
&lt;!-- s9ymdb:429 --&gt;&lt;img class="serendipity_image_left" width="493" height="250" src="http://www.ailis.de/~k/uploads/minecraft_noappname.png" alt="Java class name instead of real application name"/&gt;&lt;!-- s9ymdb:431 --&gt;&lt;img class="serendipity_image_left" width="323" height="250" src="http://www.ailis.de/~k/uploads/minecraft_nodashmenu1.png" alt="No Dash menu"/&gt;&lt;/p&gt;
&lt;p&gt;
So instead of having a nice application name like &lt;em&gt;Minecraft&lt;/em&gt; Gnome Shell displays the Java class name. This is not really a problem of Minecraft but more a problem of bad Linux integration of Java applications in general. In Gnome 2 and other desktop environments this application name wasn't really important but since Gnome 3 it is crucial to have a valid application name because the Dash (The dock of Gnome Shell) uses it to connect the running application with its application launcher. And that's another problem: Minecraft doesn't create an application launcher. It only provides a JAR file you have to run somehow. And because this launcher doesn't exist and it can't be connected to the running application because of the bad application name you don't get the usual menu in the Dash to add Minecraft to your favorites. 
&lt;/p&gt;
&lt;p&gt;
All this can't be tolerated and must be fixed. In this article I will explain how.
&lt;/p&gt;
 &lt;br/&gt;&lt;a href="http://www.ailis.de/~k/archives/73-Minecraft-and-Gnome-Shell.html#extended" &gt;Continue reading "Minecraft and Gnome Shell"&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Tue, 14 Aug 2012 10:18:50 GMT</pubDate>
      <title>Minecraft on Linux</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=77</link>
      <guid>http://www.ailis.de/~k/archives/72-Minecraft-on-Linux.html</guid>
      <description>&lt;p&gt;
  Installing &lt;a href="http://www.minecraft.net/" &gt;Minecraft&lt;/a&gt; (version 1.3.1) on Linux is not always as simple as you might think. It's a Java application so it should run on all platforms supported by Oracle but unfortunately sometimes (For some unknown reasons) this doesn't work out of the box. This article describes how to get it running on a current &lt;a href="http://www.ubuntu.com/" &gt;Ubuntu Linux&lt;/a&gt; 12.04 on a 64 bit machine and how to create a desktop entry for it so you don't have to start it with this long command mentioned on the Minecraft website.
&lt;/p&gt;
 &lt;br/&gt;&lt;a href="http://www.ailis.de/~k/archives/72-Minecraft-on-Linux.html#extended" &gt;Continue reading "Minecraft on Linux"&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Fri, 25 May 2012 16:12:18 GMT</pubDate>
      <title>How to follow an organization on GitHub</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=76</link>
      <guid>http://www.ailis.de/~k/archives/71-How-to-follow-an-organization-on-GitHub.html</guid>
      <description>&lt;p&gt;
For some reason GitHub does not display a &lt;em&gt;Follow&lt;/em&gt; button on organization pages. So you can only follow normal users or repositories. This is pretty sad because it perfectly makes sense to follow an organization if you want to be informed about new repositories created by this organization. Following the organization members instead isn't an option because then you are also notified about their personal activity which might be boring to you. And some members are not even displayed as organization members because membership can be hidden.
&lt;/p&gt;
&lt;p&gt;
Even more confusing is the fact that following an organization technically works. You can add yourself to the follower list and you are also correctly informed about new projects created by this organization. So why is GitHub not showing this button? Don't know. So you have to hack yourself into the follower list. This can be done with a single JavaScript command which you can enter into the JavaScript console of your browser (Naturally you have to be logged in into GitHub):
&lt;/p&gt;
&lt;pre&gt;$.post("https://github.com/users/follow?target=&lt;strong&gt;organizationName&lt;/strong&gt;");&lt;/pre&gt;
&lt;p&gt;
You can also check the follower list of an organization (The link to this list is also hidden on GitHub). Here is an example URL: &lt;a href="https://github.com/openwebos/followers" &gt;https://github.com/openwebos/followers&lt;/a&gt;. And when you check the &lt;a href="https://github.com/kayahr/following" &gt;&lt;em&gt;Following&lt;/em&gt; list&lt;/a&gt; of a user which follows an organization then you can even see a &lt;em&gt;Follow/Unfollow&lt;/em&gt; button for the organization. This is most likely a bug, GitHub simply forgot to remove this button when they introduced organizations (Which are simply special kinds of users).
&lt;/p&gt;
&lt;p&gt;
Now I wonder: If it is possible to follow organizations and even notifications about new organization repos works then why isn't it an official feature?
&lt;/p&gt;</description>
    </item>
    <item>
      <pubDate>Thu, 17 May 2012 14:09:26 GMT</pubDate>
      <title>Fixing JavaScript Console in older browsers and IE</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=75</link>
      <guid>http://www.ailis.de/~k/archives/70-Fixing-JavaScript-Console-in-older-browsers-and-IE.html</guid>
      <description>&lt;p&gt;
  The JavaScript console as introduced by &lt;a href="http://getfirebug.com/" &gt;Firebug&lt;/a&gt; years ago has grown to a de facto standard in many web browsers. Especially the Webkit JavaScript console in &lt;a href="https://www.google.com/chrome" &gt;Chrome&lt;/a&gt;/&lt;a href="http://www.chromium.org/" &gt;Chromium&lt;/a&gt; and &lt;a href="http://www.apple.com/safari/" &gt;Safari&lt;/a&gt; is extremely well done. Newer &lt;a href="http://www.mozilla.org/firefox/" &gt;Firefox&lt;/a&gt; versions now also come with a built-in console. Even &lt;a href="http://windows.microsoft.com/en-us/internet-explorer/products/ie/home" &gt;Internet Explorer&lt;/a&gt; comes with a basic console-like thing but unfortunately it sucks...
&lt;/p&gt;
&lt;p&gt;
  So far I used custom logging mechanisms or &lt;a href="http://log4javascript.org/" &gt;log4javascript&lt;/a&gt; to log messages in my JavaScript applications. Thanks to the JavaScript console this would be unnecessary if all browsers had descent support for it. But unfortunately the console implementations in some browsers are incomplete or completely absent. So even this harmless line of code in your application can prevent execution in Internet Explorer when the development panel is closed (In which case &lt;code&gt;window.console&lt;/code&gt; is not defined at all):
&lt;/p&gt;
&lt;pre&gt;console.warn("Config not found. Using defaults.");&lt;/pre&gt;
&lt;p&gt;
So to be able to use all console features without worrying about missing browser-support I wrote a small library called &lt;a href="https://github.com/kayahr/console-shim/" &gt;console-shim&lt;/a&gt; which detects the implemented console features and tries to complete them. Some features are emulated so they fully work in all browsers while other features are silently ignored. If console logging is not supported by the browser at all then &lt;em&gt;console-shim&lt;/em&gt; tries to use &lt;em&gt;log4javascript&lt;/em&gt; if available or it silently ignores all logging attempts. See the &lt;a href="https://github.com/kayahr/console-shim/blob/master/README.md" &gt;README&lt;/a&gt; for a full list of replacement implementations for missing functionality.
&lt;/p&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 6 May 2012 15:08:51 GMT</pubDate>
      <title>How to setup a modern HP printer in Ubuntu Linux</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=74</link>
      <guid>http://www.ailis.de/~k/archives/69-How-to-setup-a-modern-HP-printer-in-Ubuntu-Linux.html</guid>
      <description>&lt;p&gt;
Are you the (un)lucky owner of a modern HP printer which needs a closed-source binary plug-in? And are you using Ubuntu Linux? Then you might know the detailed error message &lt;strong&gt;Plug-in install failed&lt;/strong&gt; which occurs when you try to setup the printer with &lt;a href="http://hplipopensource.com/" &gt;HP Toolbox&lt;/a&gt; (From the &lt;a href="http://packages.ubuntu.com/search?keywords=hplip" &gt;hplip-gui&lt;/a&gt; package shipped with Ubuntu):
&lt;/p&gt;
&lt;p&gt;
&lt;!-- s9ymdb:425 --&gt;&lt;img class="serendipity_image_center" width="475" height="362" src="http://www.ailis.de/~k/uploads/hplip-failed.png" alt=""/&gt;&lt;/p&gt;
&lt;p&gt;
Looks like there is a permission problem somewhere. Not sure if it is Ubuntu's or HP's fault. Running the HP Toolbox as root might fix the problem but unfortunately it refuses to run as root. But there is an easy way to work around this problem. When you try to install the plug-in the HP Toolbox downloads a plug-in installation script from an HP server to your &lt;code&gt;/tmp&lt;/code&gt; directory. It then executes it (Without root privileges I guess) which fails. That's why you get the &lt;strong&gt;Plug-in install failed&lt;/strong&gt; error message. Cancel all dialogs and close the HP Toolbox and execute this command in your terminal:
&lt;/p&gt;
&lt;pre&gt;
sudo bash /tmp/hplip-3.12.2-plugin.run.1
&lt;/pre&gt;
&lt;p&gt;
The version number may be different so check out which files are located in your &lt;code&gt;/tmp&lt;/code&gt; directory first. You'll have to confirm the license and after the installation is complete it will print &lt;strong&gt;Done&lt;/strong&gt; to the console. When it didn't print &lt;strong&gt;Done&lt;/strong&gt; then something went wrong. Maybe you forgot to execute it with &lt;code&gt;sudo&lt;/code&gt;? When the installation was successful then start the HP Toolbox again and setup your printer. The tool will not try to install the plug-in again because this time it is already there and it works.
&lt;/p&gt;
&lt;p&gt;
Happy printing (and happy scanning and faxing if your printer supports it)!
&lt;/p&gt;</description>
    </item>
    <item>
      <pubDate>Sun, 6 May 2012 00:08:43 GMT</pubDate>
      <title>Self-made Gubuntu</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=73</link>
      <guid>http://www.ailis.de/~k/archives/68-Self-made-Gubuntu.html</guid>
      <description>&lt;p&gt;
In 2010 the world was still in order:
&lt;a href="http://www.kubuntu.org/" &gt;Kubuntu&lt;/a&gt; for &lt;a href="http://kde.org" &gt;KDE&lt;/a&gt;, &lt;a href="http://www.xubuntu.org/" &gt;Xubuntu&lt;/a&gt; for &lt;a href="http://www.xfce.org/" &gt;XFCE&lt;/a&gt;, &lt;a href="http://lubuntu.net/" &gt;Lubuntu&lt;/a&gt; for &lt;a href="http://www.lxde.org/" &gt;LXDE&lt;/a&gt;, &lt;a href="http://www.ubuntu.com/" &gt;Ubuntu&lt;/a&gt; for &lt;a href="http://www.gnome.org/" &gt;Gnome&lt;/a&gt;. This has changed now. The latest Ubuntu LTS release (And the two previous Non-LTS releases) are using &lt;a href="http://unity.ubuntu.com/" &gt;Unity&lt;/a&gt; as user interface instead of Gnome. Unity is based on Gnome 3 but it is pretty different to a standard Gnome 3 environment (Which uses &lt;a href="http://live.gnome.org/GnomeShell" &gt;Gnome Shell&lt;/a&gt;). Hopefully some day there will be something like a &lt;em&gt;Gubuntu&lt;/em&gt; distribution which focuses on a standard Gnome environment with Gnome Shell as user interface. But for now we have to get rid of Unity manually. This article explains how to do it and also describes some additional tweaks and hacks to make Gnome more usable.
&lt;/p&gt; &lt;br/&gt;&lt;a href="http://www.ailis.de/~k/archives/68-Self-made-Gubuntu.html#extended" &gt;Continue reading "Self-made Gubuntu"&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Thu, 12 Apr 2012 17:09:15 GMT</pubDate>
      <title>Workaround for borderless Java Swing menus on Linux</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=72</link>
      <guid>http://www.ailis.de/~k/archives/67-Workaround-for-borderless-Java-Swing-menus-on-Linux.html</guid>
      <description>&lt;p&gt;
  Since years Linux users are plagued by a bug which affects the rendering of Swing popup menus. When using a modern GTK theme (Like Gnome's Adwaita or Ubuntu's Ambiance and Radiance) then menus in Java Swing applications have no borders and no separators:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.ailis.de/~k/uploads/brokenmenu.png" &gt;&lt;!-- s9ymdb:424 --&gt;&lt;img class="serendipity_image_center" width="110" height="82" src="http://www.ailis.de/~k/uploads/brokenmenu.serendipityThumb.png" alt=""/&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Several bug reports exists (Like &lt;a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6925412" &gt;#6925412&lt;/a&gt;) but it seems to be unclear if this is a bug in the affected GTK themes or a bug in Java's &lt;code&gt;GTKLookAndFeel&lt;/code&gt; class. Fact is: I'm pretty sure this bug will not be fixed anytime soon so we have to find a workaround and in this article I will show you two different approaches.
&lt;/p&gt; &lt;br/&gt;&lt;a href="http://www.ailis.de/~k/archives/67-Workaround-for-borderless-Java-Swing-menus-on-Linux.html#extended" &gt;Continue reading "Workaround for borderless Java Swing menus on Linux"&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Tue, 10 Apr 2012 19:11:12 GMT</pubDate>
      <title>jQuery Fullscreen Plugin</title>
      <link>http://www.advogato.org/person/Kay/diary.html?start=71</link>
      <guid>http://www.ailis.de/~k/archives/66-jQuery-Fullscreen-Plugin.html</guid>
      <description>&lt;p&gt;
  Modern browsers (Like Chrome and Firefox) provide an interesting new feature: A fullscreen mode which can be controlled by JavaScript. It is even possible to switch a single HTML element to fullscreen. This is useful for videos or images for example. Unfortunately browsers currently only provide the necessary methods with the usual browser-specific prefixes:
&lt;/p&gt;
&lt;pre&gt;// Firefox
element.mozRequestFullScreen();
document.mozCancelFullScreen();
document.mozFullScreen;

// Chrome
element.webkitRequestFullScreen();
document.webkitCancelFullScreen(); 
document.webkitIsFullScreen;&lt;/pre&gt;
&lt;p&gt;
  To simplify the usage of this new feature I wrote a small &lt;a href="http://github.com/kayahr/jquery-fullscreen-plugin/" &gt;jQuery plugin&lt;/a&gt;.
&lt;/p&gt; &lt;br/&gt;&lt;a href="http://www.ailis.de/~k/archives/66-jQuery-Fullscreen-Plugin.html#extended" &gt;Continue reading "jQuery Fullscreen Plugin"&lt;/a&gt;</description>
    </item>
  </channel>
</rss>
