<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>diederickdevries.net &#187; howto</title>
	<atom:link href="http://www.diederickdevries.net/blog/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.diederickdevries.net/blog</link>
	<description>Of penguins and coffee (mostly).</description>
	<lastBuildDate>Fri, 03 Feb 2012 17:08:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Java 3d in a NetBeans Platform Application</title>
		<link>http://www.diederickdevries.net/blog/2011/11/12/java-3d-in-a-netbeans-platform-application/</link>
		<comments>http://www.diederickdevries.net/blog/2011/11/12/java-3d-in-a-netbeans-platform-application/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 11:25:31 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[cool stuff]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[j3d]]></category>
		<category><![CDATA[j3dcore]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[java3d]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=1192</guid>
		<description><![CDATA[If you want an excellent introduction into Java 3D, look no further than here. I was following the tutorial I found there to get started with what looked to me as the perfect way of spending a Friday evening, when, somewhere at the end, it told me that: (&#8230;) it does not mix very well [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2011%2F11%2F12%2Fjava-3d-in-a-netbeans-platform-application%2F&amp;title=Java%203d%20in%20a%20NetBeans%20Platform%20Application" id="wpa2a_2"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>If you want an excellent introduction into Java 3D, look no further than <a href="http://www.java3d.org/tutorial.html">here</a>. I was following the tutorial I found there to get started with what looked to me as the perfect way of spending a Friday evening, when, somewhere at the end, it told me that:</p>
<blockquote><p>(&#8230;) <span style="font-family: TIMES; font-size: small;">it does not mix very well with Sun.s swing user interface components. These components are called &#8220;lightweight&#8221; Lightweight components can be hidden by a Canvas3D even if they are supposed to be at the front.</span></p></blockquote>
<p>Obviously, I had been planning on embedding hugely impressive 3D animations into a NetBeans Platform Application, and I was not going to be disappointed, so I fired up NetBeans and did it anyway. Here&#8217;s how.</p>
<p>Preconditions: The j3dcore JAR files are downloaded and unpacked.  You can find them <a href="http://java3d.java.net/binary-builds.html">here</a>. I never trust generic Linux installers, because I have no idea what distro those people had in mind when creating them. So I chose one from the zip binaries and ignored the installers. Select the appropriate one for your machine. Unpack the zip file. There&#8217;s a second zip file inside. Unpack it too. Put the JAR files and the <code>.so</code> file somewhere where you want to keep them.</p>
<p>There appears to exist a NetBeans <a href="http://plugins.netbeans.org/plugin/32144/java-3d">plugin</a> for java-3d, but my NetBeans (7.0.1) didn&#8217;t find it, and at least one user comment indicates massive issues, so I didn&#8217;t bother with it.</p>
<ol>
<li>Create a new Application: File -&gt; New Project. In the Wizard, under Choose Project, select NetBeans Modules -&gt; NetBeans Platform Application and click Next. Enter the name of the application. I called it Test3D. Click Finish.</li>
<li>The j3dcore JAR files have to be wrapped into a Module. Expand the Test3D project node, right click Modules and select Add New. Use j3dcore as your project name and click Next.  Use net.java.j3dcore as the Module&#8217;s code name base.</li>
<li>Right click the j3dcore module node and choose Properties. Under Libraries, click the Wrapped JARs tab and click Add JAR. Navigate to the j3dcore JAR files, select them all (hold shift or ctrl) and click OK.</li>
<li>You now have a library wrapper module, but you lack the shared object file that will allow them to use you graphics adapter. In Test3D, expand the Important Files node. Open the Project Properties file, and add the following line:
<p><code>run.args.extra=-J-Djava.library.path=&lt;the path to the location of your .so file&gt;</code></p>
<p>Do not include the name of the file itself. Be sure to add this to the Project Properties file of your main project, Test3D, and not the wrapper module. It has its own Project Properties file.</li>
<li>Add a new module that creates and displays your 3D scene. Right click Modules under Test3D and click Add New. Enter a name. I chose Universe. Enter your code name base and click Finish.</li>
<li>Add a new TopComponent. Right click the Universe node and click New -&gt; Other. In the New File wizard, select Module Development -&gt; Window. Select Editor as Window Placement and select Open on Application Start. Click Next. Enter UniverseTopComponent after Class Name Prefix and click Finish.</li>
<li>Open UniverseTopComponent. In the Design View, add a JPanel that fully covers the TopComponent. Right click it, select Change Variable Name and enter myUniverse. Right click it again, choose Set Layout -&gt; Border Layout.</li>
<li>Switch to the Source Editor, and change the constructor into this:</li>
</ol>
<blockquote><blockquote>
<pre class="brush: java">
    public UniverseTopComponent() {

        initComponents();
        setName(NbBundle.getMessage(UniverseTopComponent.class,
                &quot;CTL_UniverseTopComponent&quot;));
        setToolTipText(NbBundle.getMessage(UniverseTopComponent.class,
                &quot;HINT_UniverseTopComponent&quot;));

        GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
        Canvas3D canvas = new Canvas3D(config);
        myUniverse.add(canvas, BorderLayout.CENTER);        

        BranchGroup group = new BranchGroup();

        Sphere sphere = new Sphere(0.2f);
        group.addChild(sphere);

        Color3f lightColor = new Color3f(1.8f, 0.1f, 0.1f);
        BoundingSphere bounds =
                new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

        Vector3f lightDirection = new Vector3f(4.0f, -7.0f, -12.0f);
        DirectionalLight light = new DirectionalLight(lightColor, lightDirection);
        light.setInfluencingBounds(bounds);
        group.addChild(light);

        SimpleUniverse universe = new SimpleUniverse(canvas);
        universe.getViewingPlatform().setNominalViewingTransform();
        universe.addBranchGraph(group);

    }
</pre>
</blockquote>
</blockquote>
<ol start="9">
<li>Right click the editor window and select Fix Imports from the popup menu. Then build and run the project. Your output should look like this:</li>
</ol>
<div id="attachment_1200" class="wp-caption aligncenter" style="width: 548px"><a href="http://www.diederickdevries.net/blog/2011/11/12/java-3d-in-a-netbeans-platform-application/test3d/" rel="attachment wp-att-1200"><img class="size-full wp-image-1200" title="test3d" src="http://www.diederickdevries.net/blog/wp-content/uploads/2011/11/test3d.png" alt="Screenshot Test3d Example Application" width="538" height="495" /></a><p class="wp-caption-text">Test3D with Universe Window</p></div>
<p>Conclusion: it is possible to embed a Java 3D scene into a NetBeans Platform Application.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/11/12/java-3d-in-a-netbeans-platform-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Arch on an Asus U36JC Notebook</title>
		<link>http://www.diederickdevries.net/blog/2011/10/20/installing-arch-on-an-asus-u36jc-notebook/</link>
		<comments>http://www.diederickdevries.net/blog/2011/10/20/installing-arch-on-an-asus-u36jc-notebook/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 16:29:05 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[cool stuff]]></category>
		<category><![CDATA[gadgets]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[acpi]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[asus]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[notebook]]></category>
		<category><![CDATA[nvidia]]></category>
		<category><![CDATA[suspend]]></category>
		<category><![CDATA[windows7]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=1044</guid>
		<description><![CDATA[Last weekend, I bought an Asus Pro36s notebook, also known as a U36JC. It features a quad core 64 bit Intel Core i5-2410M CPU at 2.3 Ghz, 4 GB DDR3 RAM, a 500 GB hard drive and an Nvidia GeForce GT 520M video adaptor. It weighs less than 1.5 kilos (that&#8217;s including batteries) and is [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2011%2F10%2F20%2Finstalling-arch-on-an-asus-u36jc-notebook%2F&amp;title=Installing%20Arch%20on%20an%20Asus%20U36JC%20Notebook" id="wpa2a_4"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>Last weekend, I bought an <a href="http://www.asus.com/Notebooks/Superior_Mobility/U36JC/">Asus Pro36s</a> notebook, also known as a U36JC. It features a quad core 64 bit <a href="http://ark.intel.com/products/52224">Intel Core i5-2410M</a> CPU at 2.3 Ghz, 4 GB DDR3 RAM, a 500 GB hard drive and an Nvidia <a href="http://www.nvidia.com/object/product-geforce-gt-520m-us.html">GeForce GT 520M</a> video adaptor. It weighs less than 1.5 kilos (that&#8217;s including batteries) and is somewhat smaller than the Vaio, which is just what I wanted.</p>
<p><object width="640" height="360" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/FrKgrsPVkVo&amp;hl=zh_TW&amp;feature=player_embedded&amp;version=3" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><embed width="640" height="360" type="application/x-shockwave-flash" src="http://www.youtube.com/v/FrKgrsPVkVo&amp;hl=zh_TW&amp;feature=player_embedded&amp;version=3" allowFullScreen="true" allowScriptAccess="always" allowfullscreen="true" allowscriptaccess="always" /></object></p>
<p>The notebook came with Microsoft <a href="http://windows.microsoft.com/en-US/windows7/products/home">Windows 7</a> installed, but obviously I want to use it with my favourite Linux distro, <a href="http://www.archlinux.org/">Arch</a>. Still, since I had paid good money for the Windows installation and you never know when it comes in <a title="Tech support" href="http://www.diederickdevries.net/blog/2009/06/17/tomtom-home-wont-install-solution/">handy</a>, I decided to make it a dual boot machine.</p>
<p>Installing Linux on a notebook nowadays is not as hard as it <a href="http://www.diederickdevries.net/armada/">used to be</a>. After putting Arch on an Asus U36JC, most of it works out of the box, that means, without it needing any work at all beyond installing Arch and KDE. This includes:</p>
<ul>
<li>FN-keys F1 through F12</li>
<li>Media keys (FN with cursor keys)</li>
<li>USB 2 and USB 3 ports</li>
<li>VGA out (see below)</li>
<li>HDMI out (see below)</li>
<li>SD card slot (accepts SD-HC cards too)</li>
<li>Wired and wireless network (using <a href="https://wiki.archlinux.org/index.php/NetworkManager">networkmanager</a>)</li>
</ul>
<p>Some of these still need some configuring, but the way to do that is a matter of taste. For instance: I configured the multi media keys in <a href="http://qmmp.ylsoftware.com/index_en.php">qmmp</a>, my favourite music player, but you might use something else. So what follows is a description of those parts of the installation and configuration that needed some thinking before they worked. I explain what choices were made and how I came to them, and link to pages on the Arch wiki with step-by-step guides on how to implement them.</p>
<h3>Task 1: Installation from USB</h3>
<p>The notebook doesn&#8217;t have an optical drive, so I had to install Arch from a USB drive. Normally this shouldn&#8217;t be that hard. Still, after I had <a href="https://wiki.archlinux.org/index.php/USB_Installation_Media">created</a> a bootable USB disk with the Arch ISO image, it eluded me for a while how to actually boot the machine from it. The BIOS settings menu, entered by holding F2 during boot, has a option called Boot Option Priorities. However, before I actually inserted the USB drive, it only listed the hard drive as an option. And even then the machine kept booting Windows, ignoring the priority settings I had made.</p>
<p>I read in the eManual PDF that holding ESC while booting would allow me to select the boot device to boot from. That worked.</p>
<h3>Task 2: Installing a base Arch system</h3>
<p>Early in the Arch installation process, the hard drive must be partioned and mounted. Originally the hard drive had three partitions: 1 MB with unused space, 28 MB for Windows recovery purposes, 200 GB for Windows and the rest was formatted as VFAT and labeled DATA.</p>
<p>Since that last partition wasn&#8217;t actually used by Windows, I decided to use its space for Arch. I remove the DATA partition and created a primary boot partition of 100 MB and three logical partitions, 25 GB for root, 4 MB for swap and the rest, 244 GB, for home.</p>
<p>Installing grub on <code>/dev/sda</code> presented no problems. The Windows menu entry in <code>/boot/grub/menu.lst</code> looks like this:</p>
<pre class="brush: php">
# (2) Windows
title Windows
rootnoverify (hd0,1)
chainloader +1
</pre>
<p><code>hd0,1</code> is the second partition on drive 0, or <code>sda2</code>, which is the partition Windows is installed on. The <code>makeactive</code> directive that is in the file&#8217;s example has to be removed or commented out for Windows 7.</p>
<h3>Task 3: Graphics environment</h3>
<p>After booting into Arch I found that the wired network had been correctly configured. I created a user account for myself and set up <a href="https://wiki.archlinux.org/index.php/Secure_Shell#Installing_OpenSSH">ssh</a> and <a href="https://wiki.archlinux.org/index.php/Yaourt#Installation">yaourt</a>. I use yaourt because I find it very convenient to access binary and source packages using just one command.</p>
<p>The notebook has an Nvidia graphics adapter, but it is configured in a hybrid configuration with a much less power hungry Intel graphics chip. Nvidia appears to have no plans supporting this on Linux, so simply installing the Nvidia driver didn&#8217;t work. Instead, I needed the Intel drivers and <a href="https://wiki.archlinux.org/index.php/Bumblebee#About_Bumblebee">Bumblebee</a>.</p>
<p>After installing that I installed <a href="https://wiki.archlinux.org/index.php/KDE#Full_install">KDE</a>, Gimp, LibreOffice, Xine, Qmmp and a few more of my favourite applications.</p>
<div id="attachment_1057" class="wp-caption aligncenter" style="width: 398px"><a href="http://www.diederickdevries.net/blog/2011/10/20/installing-arch-on-an-asus-u36jc-notebook/asusu36jc/" rel="attachment wp-att-1057"><img class="size-medium wp-image-1057" title="asusU36JC" src="http://www.diederickdevries.net/blog/wp-content/uploads/2011/10/asusU36JC-300x249.jpg" alt="" width="388" height="322" /></a><p class="wp-caption-text">My Asus U36JC notebook running KDE4.</p></div>
<h3>Task 4: Suspend</h3>
<p>Suspend-to-RAM, letting the notebook fall asleep quickly and making it wake up quickly again, is very useful for conserving battery power. Unfortunately, it didn&#8217;t really work out of the box. Instead of suspending, the notebook froze, showing a non blinking cursor at the top left. I tried various approaches but the solution escaped me for <a href="https://bbs.archlinux.org/viewtopic.php?id=127925">days</a>.</p>
<p>I found an Ubuntu site that offered a solution that made sense, but didn&#8217;t appear to work. In the end, I found a line in my dmesg output warning me about the mei kernel module. It appeared that if I unloaded it and implemented the Ubuntu solution, suspend-to-RAM worked. Summarising:</p>
<ol>
<li>Ditch the mei module by <a href="https://wiki.archlinux.org/index.php/Kernel_modules#Blacklisting">blacklisting</a> it. According to my dmesg output it it not safe to use. <a href="http://comments.gmane.org/gmane.linux.kernel/1153959">This</a> thread seems to confirm that.</li>
<li>Put a file called <code>20_custom-ehci_hcd</code> inside <code>/etc/pm/sleep.d/</code>. To do that, follow the instructions <a href="http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug">here</a>.</li>
</ol>
<p>After I had sorted that out, I needed only two more things for suspend-to-disk:</p>
<ol>
<li>Add <code>resume=/dev/sdaX</code> to the kernel line of the first option in <code>/boot/grub/menu.lst</code>, where X stands for the partition number of your swap drive, 6 in my case. Instructions are <a href="https://wiki.archlinux.org/index.php/Pm-utils#Hibernation_.28suspend2disk.29">here</a>.</li>
<li>Add the resume hook to the <code>HOOKS</code> variable in <code>/etc/mkinitcpio.conf</code>. Instructions are <a href="https://wiki.archlinux.org/index.php/Pm-utils#Resume_Hook">here</a>.</li>
</ol>
<h3>Task 5: Ondemand governor</h3>
<p>The next thing to look into was CPU speed governing. Despite the fact that KDE is supposed to have the CPU always on &#8216;ondemand&#8217;, I noticed that the CPU was constantly on full speed, so I installed <a href="https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling#cpufrequtils">cpufrequtils</a>. It appeared that after booting into KDE the CPU was indeed always in performance mode. To remedy this, I configured cpufreq as a daemon to always default to ondemand, by following <a href="https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling#Daemon">these</a> instructions.</p>
<h3>Task 6: Fixing the camera orientation</h3>
<p>The notebook has a camera sitting at the top of the screen panel, centred just above the screen. It works out of the box, but it appears Asus has installed the camera upside down. Why they would do that is beyond me. <del datetime="2012-02-03T16:54:00+00:00"><a href="http://hansdegoede.livejournal.com/9761.html">v4l-utils</a> Is supposed to be able to handle this problem, but at least with this notebook it doesn&#8217;t appear to work.</del> I have sent an email to Gegror Jasny, who is maintaining v4l, a library that can fix this. He emailed me back with a versions 8.6 and 9.0 (testing) of the project, which included data I had sent him. It worked perfectly, so as soon as he makes a release and the Arch package is updated, this will be fixed.</p>
<p><del datetime="2012-02-03T16:54:00+00:00">It all depends on what you&#8217;re using the camera for. </del>If you&#8217;re using <a href="http://kopete.kde.org/">Kopete</a>, you can go to Settings -&gt; Video -&gt; Options and select vertical as well as horizontal mirroring to turn the image 180 degrees.</p>
<p>Or using <a href="http://www.mplayerhq.hu/">mplayer</a>:</p>
<pre># mplayer tv:// -tv driver=v4l2 -flip</pre>
<p>Obviously, all this costs CPU power. Using mplayer in full screen mode you can even see yourself blink. And to think that this is only needed because the Asus people installed the camera the wrong way. :rolleyes:</p>
<h3>Task 7: Synaptics touchpad</h3>
<p>I don&#8217;t have very special requirements for a touchpad, but I&#8217;d like to be able to drag stuff by double tapping and then dragging with only one finger and vertical scrolling by dragging a finger along the right edge. This didn&#8217;t work out of the box. Still, doing that is so easy that I only added it here for completion. First, I installed the driver:</p>
<p><code># yaourt -S xf86-input-synaptics</code></p>
<p>Then I added a single line to /etc/X11/xorg.conf.d/10-synaptics.conf:</p>
<pre class="brush: php">
Section &quot;InputClass&quot;
        Identifier &quot;touchpad catchall&quot;
        Driver &quot;synaptics&quot;
        MatchIsTouchpad &quot;on&quot;
        MatchDevicePath &quot;/dev/input/event*&quot;
        Option &quot;TapButton1&quot; &quot;1&quot;
        Option &quot;TapButton2&quot; &quot;3&quot;
        Option &quot;TapButton3&quot; &quot;2&quot;
        Option &quot;VertEdgeScroll&quot; &quot;on&quot;
EndSection
</pre>
<h3>Task 8: Hard drive spin down</h3>
<p>One of the more annoying habits of the notebook is that the default hard drive power saving setting is too aggressive. The hard drive keeps spinning down all the time, so that lots of times the notebook appears frozen for a second or two when the hard drive is needed. Also, some low level processes use the hard drive periodically, resulting in audible clicking sounds every few seconds.</p>
<p>To avoid this, I installed laptop mode tools and added it to my <code>/etc/rc.conf</code>:</p>
<pre># yaourt -S laptop-mode-tools
# sudo vim /etc/rc.conf</pre>
<pre class="brush: php">
DAEMONS=(hwclock syslog-ng dbus !hal laptop-mode avahi-daemon networkmanager sshd sensors @crond @bumblebee @cups @alsa @cpufreq @mysqld)
</pre>
<p>Then I changed the default spin down value in <code>/etc/laptop-mode/laptop-mode.conf</code> to 128. This is a good value between never spinning down at all and spinning down too often.</p>
<pre># sudo vim /etc/laptop-mode/laptop-mode.conf</pre>
<pre class="brush: php">
#
# Power management for HD (hdparm -B values)
#
BATT_HD_POWERMGMT=128
LM_AC_HD_POWERMGMT=254
NOLM_AC_HD_POWERMGMT=254
</pre>
<p>One thing that accesses my hard drive a lot is ext4&#8242;s journalling program. To prevent it from doing that, I added <code>commit=600</code> to my <code>/etc/fstab</code> entries for <code>/home</code> and <code>/</code>:</p>
<pre class="brush: php">
UUID=...       /       ext4    defaults,noatime,commit=600     0       1
UUID=...       /home   ext4    defaults,noatime,commit=600     0       1
</pre>
<p>The <code>noatime</code> attribute specifies that the last access time of every file is not recorded. This significantly speeds up hard drive performance.</p>
<h3>A note on the HDMI and VGA ports</h3>
<p>When the computer is booted while connected to a second monitor or TV, via either the VGA or HDMI ports, the screen&#8217;s contents will be duplicated on that screen. The second screen&#8217;s resolution appears to be leading. KDE&#8217;s control centre however will allow the user to configure this behaviour. Go to Hardware->Screen and monitor->Multiple Monitors. I am not sure if and how this works in other environments.</p>
<p>After updating to KDE 4.7.3 last weekend, I noticed that even when I connected the HDMI port to my TV after the notebook had already booted, a pop up came up that told me that a second monitor had been detected. It then took me to the KDE control centre section mentioned above. I didn&#8217;t find any reference to this in the KDE 4.7.3 release notes, so this could also work with previous releases.</p>
<p>VGA is <a href="http://www.techsupportforum.com/forums/f25/what-is-hot-swappable-8571.html">not</a> supposed to be hot pluggable, so I&#8217;m not going to look into that.</p>
<h3>Concluding remarks</h3>
<p>It took a few days of searching and trying out various solutions to get suspend-to-RAM to work, the hybrid graphics setup is not ideal, and the camera is upside-down. But most of the notebook works out of the box. FN-keys, networking, and also the camera.</p>
<p>Whatever notebook you&#8217;re going to put Linux on, there will probably always be a few drawbacks. Notebooks get smaller, faster, cool better and need less power every year, so I imagine that manufacturers will need more and more hacks to make all that work. When you&#8217;re using the proprietary OS that came pre-installed, you&#8217;ll probably never notice these things but if you want all the advantages of Linux, you will have to deal with them.</p>
<p>The Asus U36JC is in my opinion a pretty decent notebook to use with Linux, or at least with Arch. It is fast, light, subtle in appearance and with a few minor tweaks can be turned into a very powerful mobile Linux platform.</p>
<h5>Updates:</h5>
<ol>
<li>Oct 20, 2011: Initial publication.</li>
<li>Oct 21, 2011: Added Task 7.</li>
<li>Oct 29, 2011: Added Task 8.</li>
<li>Nov 17, 2011: Added a note on the HDMI and VGA ports.</li>
<li>Feb 3, 2012: Updated the entry about v4l entry in task 6.</li>
</ol>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/10/20/installing-arch-on-an-asus-u36jc-notebook/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Native look and feel for Swing under Linux</title>
		<link>http://www.diederickdevries.net/blog/2011/04/19/native-look-and-feel-for-swing-under-linux/</link>
		<comments>http://www.diederickdevries.net/blog/2011/04/19/native-look-and-feel-for-swing-under-linux/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 18:41:30 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[gtk]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[kde]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[qt4]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=893</guid>
		<description><![CDATA[This one is not really an eye-opener, but I use this blog to record and archive stuff I find out at some point, so here&#8217;s a post about getting NetBeans Platform Applications use GTK instead of Metal. Since the Swing Application Framework (SAF) has been deprecated and developing NetBeans Platform Applications (NPA) is the new [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2011%2F04%2F19%2Fnative-look-and-feel-for-swing-under-linux%2F&amp;title=Native%20look%20and%20feel%20for%20Swing%20under%20Linux" id="wpa2a_6"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>This one is not really an eye-opener, but I use this blog to record and archive stuff I find out at some point, so here&#8217;s a post about getting NetBeans Platform Applications use GTK instead of Metal.</p>
<p>Since the Swing Application Framework (SAF) has been <a href="http://netbeans.org/kb/68/java/gui-saf.html">deprecated</a> and developing <a href="http://netbeans.org/features/platform/">NetBeans Platform Applications</a> (NPA) is the new and better way to do these things, I&#8217;ve bought a good <a href="http://www.packtpub.com/netbeans-platform-6-9-developers-guide/book">book</a> on the subject, and am quite satisfied with the way Java desktop applications are to be developed these days.</p>
<p>However, under Linux, Swing applications default to the ugly Metal widget set:</p>
<div id="attachment_894" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-894" href="http://www.diederickdevries.net/blog/2011/04/19/native-look-and-feel-for-swing-under-linux/metal/"><img class="size-medium wp-image-894" title="metal" src="http://www.diederickdevries.net/blog/wp-content/uploads/2011/04/metal-300x225.png" alt="" width="300" height="225" /></a><p class="wp-caption-text">Metal widget set. Click to zoom.</p></div>
<p style="text-align: center;">&nbsp;</p>
<p>On the command line and using SAF it is in fact pretty <a title="QT4 look and feel for Swing" href="http://www.diederickdevries.net/blog/2009/04/29/qt4-look-and-feel-for-swing/">easy</a> to make Swing use the GTK widgets. This way Java applications get a native look and feel under Linux. With NPA however, there is no right place to insert a few lines of code to do this at startup.</p>
<p>To make NetBeans itself use the GTK widgets, I always start the IDE like this:</p>
<pre># netbeans --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel</pre>
<p>Since NetBeans is itself an NPA,  I figured the trick would be to specify this option somewhere in the application&#8217;s configuration. I googled around a bit and found the answer <a href="http://wiki.netbeans.org/DevFaqPlatformRuntimeProperties">here</a>. The trick is to add a single line to the <code>project.properties</code> file, which can be found inside the Important Files folder within the NPA project. That line is:</p>
<pre>run.args.extra=--laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel</pre>
<p>And now, under KDE4, my application looks like this:</p>
<div id="attachment_895" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-895" href="http://www.diederickdevries.net/blog/2011/04/19/native-look-and-feel-for-swing-under-linux/gtk/"><img class="size-medium wp-image-895" title="gtk" src="http://www.diederickdevries.net/blog/wp-content/uploads/2011/04/gtk-300x225.png" alt="" width="300" height="225" /></a><p class="wp-caption-text">GTK widget set. Click to zoom.</p></div>
<p style="text-align: center;">&nbsp;</p>
<p>Not exactly a KDE4 look-and-feel, but I have lots of applications (Gimp, GQView,  LibreOffice) that use GTK so it still looks native on my desktop, and GTK is a lot prettier than Metal.</p>
<p>Now why it is a good idea to write desktop applications instead of web applications, especially in Java, is something that Geertjan Wielenga <a href="http://java.dzone.com/why-desktop-not-webapp">talks</a> about on his blog. Well worth the read.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/04/19/native-look-and-feel-for-swing-under-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying EJB3 In Action code examples in NetBeans</title>
		<link>http://www.diederickdevries.net/blog/2011/03/25/deploying-ejb3-in-action-code-examples-in-netbeans-2/</link>
		<comments>http://www.diederickdevries.net/blog/2011/03/25/deploying-ejb3-in-action-code-examples-in-netbeans-2/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 08:34:08 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[ejb3]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=569</guid>
		<description><![CDATA[I&#8217;m currently learning Enterprise Java Beans 3 using Debu Panda et al.&#8217;s book EJB3 in Action. The material is not very hard but there&#8217;s lots of stuff to memorize, and the best way to do that is by running the code examples and trying to change it (and break it). The easiest way to do [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2011%2F03%2F25%2Fdeploying-ejb3-in-action-code-examples-in-netbeans-2%2F&amp;title=Deploying%20EJB3%20In%20Action%20code%20examples%20in%20NetBeans" id="wpa2a_8"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>I&#8217;m currently learning <a href="http://www.oracle.com/technetwork/java/docs-135218.html">Enterprise Java Beans 3</a> using Debu Panda et al.&#8217;s book<a href="http://www.manning.com/panda/"> EJB3 in Action</a>. The material is not very hard but there&#8217;s lots of stuff to memorize, and the best way to do that is by running the code examples and trying to change it (and break it). The easiest way to do that is by using an IDE, but the book isn&#8217;t very  helpful in that area, and I didn&#8217;t find it really transparent or straightforward, so here&#8217;s a write up of what I did to make the code examples of the first chapter work in <a href="http://netbeans.org/">NetBeans</a>.</p>
<p>You&#8217;ll need a NetBeans installation with most of the trimmings for this to work. Make sure GlassFish Server 3 and JavaDB are working.</p>
<p>The first chapter is about a simple <a href="http://en.wikipedia.org/wiki/Hello_world_program">Hello World</a> application. To deploy it, we need an EJB3 module and a Web Application Module. The latter will be the client, replacing the client application provided by the book.</p>
<ol>
<li>In NetBeans, create a new project: Java EE -&gt; Enterprise Application (click Next).</li>
<li>Enter <code>HelloUser</code> as project name and click Next.</li>
<li>Click Enable Context and Dependency Injection and click Finish.</li>
<li>Download and unzip the example sources.</li>
<li>Within the newly created directory, locate the directory <code>glassfish/chapter1/src/ejb/bean/ejb3inaction</code>, and copy it to <code>HelloUser/HelloUser-ejb/src/java/</code> within your NetBeans project directory.</li>
<li>From the example sources directory,  locate the directory <code>glassfish/chapter1/src/ejb/client/ejb3inaction</code>, and copy it to <code>HelloUser/HelloUser-war/src/java/</code> within your NetBeans project directory.</li>
</ol>
<p>The client class provided by the book is a very simple illustration of what has been explained so far:</p>
<pre class="brush: java">
package ejb3inaction.buslogic;

import ejb3inaction.example.HelloUser;

import javax.ejb.EJB;

public class HelloUserClient {

    @EJB
    private static HelloUser helloUser;

    public static void main(String[] args) {
        helloUser.sayHello(&quot;Curious George&quot;);
        System.out.println(&quot;Invoked EJB successfully .. see server console for output&quot;);
    }
}
</pre>
<p>This is not something that I could run from inside NetBeans, so I wrote a <a href="http://www.novocode.com/doc/servlet-essentials/">servlet</a> that contains the same code.</p>
<ol>
<li>In the Projects frame, expand HelloUser-war -> Source Packages -> ejb3inaction.example. This package was created when we copied the files to HelloUser-war, back in step 6.</li>
<li>Right click the package node and click New Servlet&#8230;</li>
<li>Use <code>HelloUserServlet</code> as class name and select Add information to deployment descriptor (web.xml). Click Finish.</li>
<li>Replace everything between the import statements and the HttpServlet methods (they&#8217;re folded) with the following:</li>
</ol>
<pre class="brush: java">
import javax.ejb.EJB;

public class HelloUserServlet extends HttpServlet {

    @EJB
    private HelloUser bean;

    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType(&quot;text/html;charset=UTF-8&quot;);

        bean.sayHello(&quot;Curious George&quot;);

        PrintWriter out = response.getWriter();
        try {
            out.println(&quot;&lt;html&gt;&quot;);
            out.println(&quot;&lt;head&gt;&quot;);
            out.println(&quot;&lt;title&gt;Servlet HelloUserServlet&lt;/title&gt;&quot;);
            out.println(&quot;&lt;/head&gt;&quot;);
            out.println(&quot;&lt;body&gt;&quot;);
            out.println(&quot;&lt;p&gt;Invoked EJB successfully .. see server console for output&lt;/p&gt;&quot;);
            out.println(&quot;&lt;/body&gt;&quot;);
            out.println(&quot;&lt;/html&gt;&quot;);
        } finally {
            out.close();
        }
    } 
</pre>
<p>As you can see, it is very easy to create a servlet that does what the main method in the client class from the book does, by simply copying a few lines and removing a few unneeded ones from the default servlet created by NetBeans.</p>
<p>When you run the project, your web browser will come up but you won&#8217;t see the output yet. Direct it to <code>http://localhost:8080/HelloUser-war/HelloUserServlet</code>. You should see a single line of text. In NetBeans, go to the output window and select the GlassFish Server 3 tab. There should be a line starting with the word <code>INFO</code>, followed by the text from <code>HelloUserBean.sayHello()</code>.</p>
<p>Now let&#8217;s see if this approach will work equally well for the rest of the examples in the book.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/03/25/deploying-ejb3-in-action-code-examples-in-netbeans-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scry and eregi deprecation</title>
		<link>http://www.diederickdevries.net/blog/2011/02/09/scry-and-eregi-deprecation/</link>
		<comments>http://www.diederickdevries.net/blog/2011/02/09/scry-and-eregi-deprecation/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 20:07:29 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[scry]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=545</guid>
		<description><![CDATA[One of the downsides of using software that is not being maintained anymore, is that when dependencies change, its users have to adapt the software. Scry, my favorite photo album software, is running in PHP, which makes that a dependency. Scry makes use of the PHP functions eregi() and eregi_replace(), which scan strings for pattern [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2011%2F02%2F09%2Fscry-and-eregi-deprecation%2F&amp;title=Scry%20and%20eregi%20deprecation" id="wpa2a_10"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>One of the downsides of using software that is not being maintained anymore, is that when dependencies change, its users have to adapt the software. <a href="http://scry.org/">Scry</a>, my favorite photo album software, is running in <a href="http://php.net/">PHP</a>, which makes that a dependency.</p>
<p>Scry makes use of the PHP functions <code><a href="http://nl3.php.net/manual/en/function.eregi.php">eregi()</a></code> and <code><a href="http://nl3.php.net/manual/en/function.eregi-replace.php">eregi_replace()</a></code>, which scan strings for pattern matches using regular expressions, or <a href="http://en.wikipedia.org/wiki/Regular_expression">regex</a>. Both functions have been <a href="http://en.wikipedia.org/wiki/Deprecation">deprecated</a> since PHP version 5.3. When running Scry in any PHP version since 5.3, the web server produces a warning message for every time a visitor does a request involving one of these functions. It is easy to make these messages go away by opening the Scry source files in an editor and putting an @-sign before every <code>eregi()</code> or <code>eregi_replace()</code> function call, but that will still clog the web server&#8217;s error log.</p>
<p>The irony of choosing an unmaintained package for its low maintenance aside, the trick is to replace each call to these functions with <code><a href="http://nl3.php.net/manual/en/function.preg-match.php">preg_match()</a></code> and <code><a href="http://nl3.php.net/manual/en/function.preg-replace.php">preg_replace()</a></code> respectively. These use <a href="http://perldoc.perl.org/perlre.html">Perl</a> style regex though, so the function arguments need adjusting too. Perl regex always needs to be delimited, and an extra <code>i</code> is needed to make it case insensitive, like PHP&#8217;s <code>eregi()</code>. Here&#8217;s an example from exif.php, the file that processes exif information in the pictures.</p>
<p>Using <code>eregi()</code>:</p>
<pre class="brush: php">
...
if (eregi(&quot;NIKON&quot;, $make)) {
...
</pre>
<p>Using <code>preg_match</code>:</p>
<pre class="brush: php">
...
if (preg_match(&quot;/NIKON/i&quot;, $make)) {
...
</pre>
<p>I have created patches that will do all the work for you. I don&#8217;t have access to the project&#8217;s <a href="http://cvs.sourceforge.net/viewcvs.py/scry/scry/">CVS</a>, so I have <a href="http://sourceforge.net/tracker/?func=detail&amp;aid=3157127&amp;group_id=5015&amp;atid=355015">uploaded</a> them to Scry&#8217;s feature request forum, but you can also download them <a href="http://www.diederickdevries.net/goodies/scry-regex-patches.tar.gz">here</a>.</p>
<p>There are three files. Each file holds the changes that must be made to one of the files that Scry is composed of. Download them and copy them to the directories where the original files are. <code>cd</code> Into the directories and then apply them like this:</p>
<pre># patch &lt; patchfile</pre>
<p>I hope this  will be of use and welcome feedback.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/02/09/scry-and-eregi-deprecation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diaspora on Arch</title>
		<link>http://www.diederickdevries.net/blog/2010/09/16/diaspora-on-arch/</link>
		<comments>http://www.diederickdevries.net/blog/2010/09/16/diaspora-on-arch/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 14:13:43 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[cool stuff]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[lifestyle]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[privacy]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=330</guid>
		<description><![CDATA[I have some kind of a love/hate relationship with Facebook. I like being up to speed on what people I know or once knew are up to and the network site allows to me to conveniently stay in contact with people without any effort on my part. That said, Facebook has a questionable reputation where [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2010%2F09%2F16%2Fdiaspora-on-arch%2F&amp;title=Diaspora%20on%20Arch" id="wpa2a_12"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>I have some kind of a love/hate relationship with <a href="http://www.facebook.com/">Facebook</a>. I like being up to speed on what people I know or once knew are up to and the network site allows to me to conveniently stay in contact with people without any effort on my part. That said, Facebook has a questionable <a href="http://arstechnica.com/web/news/2010/07/students-finally-wake-up-to-facebook-privacy-issues.ars">reputation</a> where it comes to privacy and for Facebook to be useful to you, you have to post private stuff, like your birthday, relationship status, holiday pictures, who your friends are or what&#8217;s on your mind. Some people go even further, by posting more explicit pictures or revealing their moment-to-moment location, but I don&#8217;t do that. Sure, you can lock your account to people not in your network, but Facebook has an interest in me sharing as much as I can, so how can I trust them?</p>
<p>Enter <a href="http://www.joindiaspora.com/">Diaspora</a>. From Wikipedia:</p>
<blockquote><p>Diaspora (also Diaspora*) is an open-source personal web server software intended to provide a distributed social networking service, a decentralized alternative to Facebook. The initial developer release was on the 15th September 2010 and a consumer alpha is planned for October 2010.</p>
<p>The project&#8217;s intent is to provide the ability to have &#8220;the little games, the little walls, the little chat&#8221; that a Facebook user&#8217;s experience currently provides, but instead hosted on users&#8217; personal web servers (called &#8220;seeds&#8221;) so that users can &#8220;fully control the information they share.&#8221;</p></blockquote>
<p>September 15th was yesterday, so I decided to try it out. The website tells you <a href="http://github.com/diaspora/diaspora">how to build</a> it on Ubuntu, Fedora or MacOS, so I adapted the instructions for my favorite OS, <a href="http://www.archlinux.org/">Arch</a>:</p>
<p>These steps expect two things:</p>
<ul>
<li> AUR to be setup. See <a href="http://wiki.archlinux.org/index.php/Arch_User_Repository">http://wiki.archlinux.org/index.php/Arch_User_Repository</a> on how to do that.</li>
<li>You don&#8217;t have ruby 1.9 installed. Diaspora has ruby gems working only in ruby 1.8</li>
</ul>
<p>Install dependencies using pacman:</p>
<p><code># sudo pacman -S openssl imagemagick git libffi libxslt</code></p>
<p>There could be dependencies that I didn&#8217;t notice because I had them already installed, but these are noted on the website. Then, install ruby 1.8, ruby-gems and bundler:</p>
<p><code># wget http://aur.archlinux.org/packages/ruby1.8/ruby1.8.tar.gz<br />
# tar xzvf ruby1.8.tar.gz<br />
# cd ruby1.8<br />
# makepkg -s (installed tk, tcl)<br />
# sudo pacman -U ruby1.8-1.8.7_p302-1-i686.pkg.tar.xz<br />
</code></p>
<p><code><br />
# wget http://aur.archlinux.org/packages/rubygems1.8/rubygems1.8.tar.gz<br />
# tar xzvf rubygems1.8.tar.gz<br />
# cd rubygems1.8<br />
# makepkg -s<br />
# sudo pacman -U rubygems1.8-1.3.7-1-i686.pkg.tar.xz<br />
</code></p>
<p><code><br />
# sudo gem-1.8 install bundler<br />
# PATH=$PATH:/opt/ruby1.8/bin/<br />
</code></p>
<p>Install mongodb:<br />
<code><br />
# wget http://aur.archlinux.org/packages/mongodb/mongodb.tar.gz<br />
# tar xzvf mongodb.tar.gz<br />
# cd mongodb<br />
# makepkg -s (also installed spidermonkey, scons, boost, sconsboost-lib, nspr; took a long time).<br />
# sudo pacman -U mongodb-1.6.2-1-i686.pkg.tar.xz<br />
</code></p>
<p>Clone and build Diaspora:<br />
<code><br />
# git clone http://github.com/diaspora/diaspora.git<br />
# cd diaspora<br />
# bundle install (will fetch source index and ask for your password)<br />
</code></p>
<p>And finally, run Diaspora:</p>
<p><code># sudo /etc/rc.d/mongodb start<br />
# rake db:seed:tom<br />
# bundle exec thin start<br />
</code></p>
<p>Now direct your browser to <a href="http://localhost:3000/">http://localhost:3000/</a>, then login with user tom and password evankorth. More information can be found <a href="http://github.com/diaspora/diaspora">here</a>.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2010/09/16/diaspora-on-arch/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>KDevelop 4: first steps</title>
		<link>http://www.diederickdevries.net/blog/2010/08/25/kdevelop-4-first-steps/</link>
		<comments>http://www.diederickdevries.net/blog/2010/08/25/kdevelop-4-first-steps/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 21:48:12 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[cool stuff]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[kde]]></category>
		<category><![CDATA[kdevelop]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=309</guid>
		<description><![CDATA[This will be one of those blog entries that I write primarily to document for myself some stuff I found out after some effort, but that might also be useful for others. When developing applications, I primarily use Java, mostly because it will do everything I want and it&#8217;s the language I&#8217;m most familiar with. [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2010%2F08%2F25%2Fkdevelop-4-first-steps%2F&amp;title=KDevelop%204%3A%20first%20steps" id="wpa2a_14"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>This will be one of those blog entries that I write primarily to document for myself some stuff I found out after some effort, but that might also be useful for others.</p>
<p>When developing applications, I primarily use <a href="http://www.java.com/en/">Java</a>, mostly because it will do everything I want and it&#8217;s the language I&#8217;m most familiar with. My IDE of choice is <a href="http://netbeans.org/">Netbeans</a>.</p>
<p>However, my desktop environment of choice is <a href="http://www.kde.org/">KDE</a>, and recently I thought of developing a <a href="http://vimeo.com/1393125">plasmoid</a>, so I decided to check out <a href="http://www.kdevelop.org/">KDevelop 4</a>, the IDE that seems most suited for KDE development. I got as far as a <a href="http://en.wikipedia.org/wiki/Hello_world_program">hello world</a> in <a href="http://en.wikipedia.org/wiki/C%2B%2B">C++</a>. Here are my first steps.</p>
<p>First I installed KDevelop and cmake. In <a href="http://www.archlinux.org/">Arch Linux</a> (my primary OS for some time now), I did that thusly:</p>
<pre># sudo pacman -Sy kdevelop cmake</pre>
<p>Then I ran KDevelop and started a new project:</p>
<ol>
<li>Click Project -&gt; New From Template&#8230;</li>
<li>Select C++ -&gt; No GUI (CMake) -&gt; Simple CMake-base C++ application</li>
<li>Enter <code>hellokde</code> at Application Name</li>
<li>Select None at Version Control System, then click Finish.</li>
<li>Enter the path to your project directory at Installation prefix, then click OK.</li>
</ol>
<p>Build the project:</p>
<ol>
<li>Right click on hellokde and select build.</li>
<li>Wait until the build window says *** Finished ***.</li>
</ol>
<p>Start the application:</p>
<ol>
<li>Click Run -&gt; Configure Launches&#8230;</li>
<li>Select hellokde and click + at Launch Configurations (at the top)</li>
<li>Select Executable -&gt; Executable and click the ellipsis (Open File Dialog).</li>
<li>Navigate to the executable: projects/hellokde/build/hellokde and click OK twice.</li>
<li>Click Run -&gt; Execute Launch.</li>
</ol>
<p>Hello KDE! And now for my first plasmoid&#8230;</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2010/08/25/kdevelop-4-first-steps/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>X Forwarding and sudo</title>
		<link>http://www.diederickdevries.net/blog/2010/06/05/x-forwarding-and-sudo/</link>
		<comments>http://www.diederickdevries.net/blog/2010/06/05/x-forwarding-and-sudo/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 21:57:28 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[X11]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=289</guid>
		<description><![CDATA[I administrate a remote linux machine of someone I know who now and then needs me to help him out. To find out if applications actually work, I use X forwarding. To do that, the remote box has X forwarding enabled, by having this line in its /etc/ssh/sshd_config: X11Forwarding yes Then I use: me@localbox:~$ ssh [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2010%2F06%2F05%2Fx-forwarding-and-sudo%2F&amp;title=X%20Forwarding%20and%20sudo" id="wpa2a_16"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>I administrate a remote linux machine of someone I know who now and then needs me to help him out. To find out if applications actually work, I use X forwarding. To do that, the remote box has X forwarding enabled, by having this line in its /etc/ssh/sshd_config:</p>
<pre>X11Forwarding yes
</pre>
<p>Then I use:</p>
<pre>me@localbox:~$ ssh -X remotebox
</pre>
<p>to log in at the remote machine, and then I can use whatever X application I like, and it will display on my local monitor. But whenever I become another user on that machine, using su or sudo, X forwarding stops working, with these messages:</p>
<pre>X11 connection rejected because of wrong authentication.
Error: Can't open display: localhost:10.0
</pre>
<p>The reason for this is that</p>
<blockquote><p>X authentication is based on cookies &#8212; secret little pieces of random  data that only you and the X server know&#8230; So, you need to let the  other user in on what your cookie is (<a href="http://www.debian-administration.org/articles/494">http://www.debian-administration.org/articles/494</a>).</p></blockquote>
<p>The original user that I used to ssh into the remote machine has such a cookie, but it seems that the other users on that machine can borrow it. Lets say my user on the remote box is called `me&#8217; and the other user is called `otheruser&#8217;. Then all I need to do is make the cookie readable by the other user, and make the other user aware of the display and the cookie:</p>
<pre>me@localbox:~$ ssh -X remotebox
me@remotebox:~$ chmod 644 .Xauthority
me@remotebox:~$ su - otheruser
Password:
otheruser@remotebox:~$ export DISPLAY=localhost:10.0
otheruser@remotebox:~$ export XAUTHORITY=/home/me/.Xauthority
</pre>
<p>And then I can happily run x applications as otheruser.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2010/06/05/x-forwarding-and-sudo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lucid breaks Firefox Flash plugin (+solution)</title>
		<link>http://www.diederickdevries.net/blog/2010/05/05/lucid-break-firefox-flash-plugin-solution/</link>
		<comments>http://www.diederickdevries.net/blog/2010/05/05/lucid-break-firefox-flash-plugin-solution/#comments</comments>
		<pubDate>Wed, 05 May 2010 10:39:41 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lucid]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=283</guid>
		<description><![CDATA[After upgrading their Ubuntu 9.10 machine to 10.4 (Lucid Lynx), someone in my neighbourhood noticed that Flash had stopped working in Firefox. Googling around didn&#8217;t provide me with a solution, but reinstalling the plugin did the trick: # sudo apt-get remove flashplugin-nonfree flashplugin-installer # sudo apt-get install flashplugin-nonfree flashplugin-installer]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2010%2F05%2F05%2Flucid-break-firefox-flash-plugin-solution%2F&amp;title=Lucid%20breaks%20Firefox%20Flash%20plugin%20%28%2Bsolution%29" id="wpa2a_18"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>After upgrading their Ubuntu 9.10 machine to 10.4 (Lucid Lynx), someone in my neighbourhood noticed that Flash had stopped working in Firefox. Googling around didn&#8217;t provide me with a solution, but reinstalling the plugin did the trick:</p>
<pre># sudo apt-get remove flashplugin-nonfree flashplugin-installer
# sudo apt-get install flashplugin-nonfree flashplugin-installer</pre>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2010/05/05/lucid-break-firefox-flash-plugin-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netbeans ignores class (+ solution)</title>
		<link>http://www.diederickdevries.net/blog/2010/03/03/netbeans-ignores-class-solution/</link>
		<comments>http://www.diederickdevries.net/blog/2010/03/03/netbeans-ignores-class-solution/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 19:08:22 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=233</guid>
		<description><![CDATA[The weirdest thing happened while I was programming with my favorite IDE, Netbeans 6.8, today. When I work on big applications, I usually split them in two or three projects (usually model, view, controller). Then I import the projects in the main application project. At some point Netbeans suddenly told me it couldn&#8217;t find a [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.diederickdevries.net%2Fblog%2F2010%2F03%2F03%2Fnetbeans-ignores-class-solution%2F&amp;title=Netbeans%20ignores%20class%20%28%2B%20solution%29" id="wpa2a_20"><img src="http://www.diederickdevries.net/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p>The weirdest thing happened while I was programming with my favorite IDE, <a href="http://netbeans.org/">Netbeans</a> 6.8, today. When I work on big applications, I usually split them in two or three projects (usually model, view, controller). Then I import the projects in the main application project. At some point Netbeans suddenly told me it couldn&#8217;t find a class in an imported project to which I referred, even though nothing was wrong with it, and everything compiled perfectly using Ant. Netbeans however insisted the class wasn&#8217;t there and produced error messages and enough red warning lines to make it unworkable.</p>
<p>I googled around a bit, but found nothing. So before trying to find the actual problem, I made a copy of the class that Netbeans couldn&#8217;t find, deleted the old one, and renamed the copy to the original. And then the problem was gone.</p>
<p>What gives?</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2010/03/03/netbeans-ignores-class-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

