<?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; tech</title>
	<atom:link href="http://www.diederickdevries.net/blog/category/tech/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>Outlook territorialism</title>
		<link>http://www.diederickdevries.net/blog/2011/09/21/outlook-territorialism/</link>
		<comments>http://www.diederickdevries.net/blog/2011/09/21/outlook-territorialism/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 17:14:17 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[skepsis]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[bad bad microsoft]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[netscape]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[thunderbird]]></category>
		<category><![CDATA[windowsxp]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=1011</guid>
		<description><![CDATA[Yesterday the Microsoft Office 2003 installation at my work PC was updated to its 2007 incarnation. But when starting the new and shiny Outlook to check my calendar, I was presented this little gem of a dialogue box: Click it to see it the way it was intended. I had to scale the image to [...]]]></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%2F09%2F21%2Foutlook-territorialism%2F&amp;title=Outlook%20territorialism" 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>Yesterday the Microsoft Office 2003 installation at my work PC was updated to its 2007 incarnation. But when starting the new and shiny Outlook to check my calendar, I was presented this little gem of a dialogue box:</p>
<div id="attachment_1012" class="wp-caption aligncenter" style="width: 720px"><a href="http://www.diederickdevries.net/blog/2011/09/21/outlook-territorialism/outlook-fail/" rel="attachment wp-att-1012"><img class="size-full wp-image-1012  " title="outlook fail" src="http://www.diederickdevries.net/blog/wp-content/uploads/2011/09/outlook-fail.png" alt="" width="710" height="247" /></a><p class="wp-caption-text">Outlook being a little jealous.</p></div>
<p>Click it to see it the way it was intended. I had to scale the image to make it fit this page, but it is in Dutch anyway. Here&#8217;s what it says:</p>
<blockquote><p>&#8220;Cannot start Microsoft Outlook. MAPI32.DLL is damaged or is of a wrong version. <strong>This might be because you have installed other software for e-mail communication</strong>. Install Outlook again.&#8221; (emphasis mine)</p></blockquote>
<p>MAPI32.DLL is part of the Messaging Application Programming Interface (<a href="http://en.wikipedia.org/wiki/Messaging_Application_Programming_Interface">MAPI</a>), which is a Windows API  that allows applications to handle e-mail and other message-based communication protocols. That fact that it is a <a href="http://nl.wikipedia.org/wiki/Dynamically_Linked_Library">Dynamically Linked Library</a> (DLL) means that it is like a Shared Object (.so-) file in Unix: a library to be used by <em>several</em> programs, not just Outlook, I&#8217;d think.</p>
<p>I remember back in the late nineties when my friends and I entertained conspiracy theory notions about Internet Explorer (3?) trying to damage Netscape Navigator installations on the same computer. How it did this we didn&#8217;t think of and we obviously never found any proof. Occam&#8217;s razor would suggest that Netscape was unstable by itself.</p>
<p>Still, in the screen shot above you can see that I have Mozilla Thunderbird installed as well. So could the dialogue box be telling the truth? Is Outlook giving me the cold shoulder because I am cheating on it with Thunderbird? In any case, a sentence like that in an error message raises more questions that it answers.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/09/21/outlook-territorialism/feed/</wfw:commentRss>
		<slash:comments>0</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_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>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>Elite</title>
		<link>http://www.diederickdevries.net/blog/2011/04/14/elite/</link>
		<comments>http://www.diederickdevries.net/blog/2011/04/14/elite/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 19:27:35 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[cool stuff]]></category>
		<category><![CDATA[lifestyle]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[ocjp]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=832</guid>
		<description><![CDATA[Today, I found this in my mail: The &#8220;success kit&#8221; included a lifetime membership card for (&#8230;) an elite group of Oracle Certified Professionals (&#8230;) And I had hoped for a coffee pack But still. Excellent.]]></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%2F14%2Felite%2F&amp;title=Elite" 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>Today, I found this in my mail:</p>
<p><a rel="attachment wp-att-833" href="http://www.diederickdevries.net/blog/2011/04/14/elite/ocjp/"><img class="aligncenter size-full wp-image-833" title="ocjp" src="http://www.diederickdevries.net/blog/wp-content/uploads/2011/04/ocjp-e1302807438788.png" alt="" width="450" height="316" /></a></p>
<p>The &#8220;success kit&#8221; included a lifetime membership card for</p>
<blockquote><p>(&#8230;) an elite group of Oracle Certified Professionals (&#8230;)</p></blockquote>
<p>And I had hoped for a coffee pack <img src='http://www.diederickdevries.net/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>But still. Excellent.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/04/14/elite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The dist-upgrade button</title>
		<link>http://www.diederickdevries.net/blog/2011/04/04/the-dist-upgrade-button/</link>
		<comments>http://www.diederickdevries.net/blog/2011/04/04/the-dist-upgrade-button/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 09:54:31 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[lifestyle]]></category>
		<category><![CDATA[skepsis]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[dist-upgrade]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=658</guid>
		<description><![CDATA[A couple of years ago, when someone in my neighbourhood&#8217;s Windows XP laptop became frustratingly slow and unstable, I convinced her to install Ubuntu. Using Ubuntu she could again perform all of her computing needs comfortably. Her laptop was fast and stable again and easy to maintain. Since then, two times a year, we go [...]]]></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%2F04%2Fthe-dist-upgrade-button%2F&amp;title=The%20dist-upgrade%20button" 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>A couple of years ago, when someone in my neighbourhood&#8217;s Windows XP laptop became frustratingly slow and unstable, I convinced her to install <a href="http://www.ubuntu.com/">Ubuntu</a>. Using Ubuntu she could again perform all of her computing needs comfortably. Her laptop was fast and stable again and easy to maintain.</p>
<p>Since then, two times a year, we go through the same predictable and frustrating motions:</p>
<ol>
<li> The <em>distribution upgrade</em> button appears in Ubuntu&#8217;s update manager.<a rel="attachment wp-att-673" href="http://www.diederickdevries.net/blog/2011/04/04/the-dist-upgrade-button/update-manager-upgrade-804/"><img class="aligncenter size-full wp-image-673" title="update-manager-upgrade-804" src="http://www.diederickdevries.net/blog/wp-content/uploads/2011/04/update-manager-upgrade-804.png" alt="" width="350" height="131" /></a></li>
<li> Usually a few weeks later, when her dependency on her computer is temporarily somewhat lower, we do a backup of her home directory and click the <em>upgrade</em> button. After all, new and better versions of all installed software packages are waiting for her.</li>
<li>After the upgrade has finished, she tries to restore her previous set-up and colour scheme in the new Ubuntu, insofar as it will let her.</li>
<li> The next weekend we decide to do a fresh installation of the new Ubuntu, because it is less hassle than trying to fix all the odd quirks that have surfaced since the upgrade.</li>
<li> She now has to fully recreate her previous set-up and colour scheme.</li>
<li> She decides to learn to live with what seems to be the new set of bugs for the coming six months.</li>
</ol>
<p>This morning I read The Register&#8217;s <a href="http://www.theregister.co.uk/2011/04/01/ubuntu1004_beta_review/">review</a> of the latest Ubuntu beta. <del>Apparently Ubuntu is no longer fast or stable</del>. If it is any indication, Ubuntu won&#8217;t be very fast or stable. I think I should try to convince her to install <a href="http://www.archlinux.org/">Arch</a>. It&#8217;s either that, or buy her a <a href="http://www.apple.com/nl/macbook/">Mac</a>.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/04/04/the-dist-upgrade-button/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Recycle fail</title>
		<link>http://www.diederickdevries.net/blog/2011/04/01/recycle-fail/</link>
		<comments>http://www.diederickdevries.net/blog/2011/04/01/recycle-fail/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 13:20:05 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[bad bad microsoft]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[recyclebin]]></category>
		<category><![CDATA[sid]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=642</guid>
		<description><![CDATA[Speaking of inconsistencies, here&#8217;s a nice one that brightened up my morning today: Too bad the dialogue doesn&#8217;t tell me the path and file name causing the problem. That would actually have been useful. In Windows 7, every user has her own personal recycle bin. All recycle bins are located under C:\$Recycle.Bin\ and have that [...]]]></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%2F01%2Frecycle-fail%2F&amp;title=Recycle%20fail" 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>Speaking of <a title="Windows 7: still an inconsistent mess" href="http://www.diederickdevries.net/blog/2011/03/31/windows-7-still-an-inconsistent-mess/">inconsistencies</a>, here&#8217;s a nice one that brightened up my morning today:</p>
<p><a rel="attachment wp-att-644" href="http://www.diederickdevries.net/blog/2011/04/01/recycle-fail/toolong/"><img class="aligncenter size-full wp-image-644" title="toolong" src="http://www.diederickdevries.net/blog/wp-content/uploads/2011/04/toolong.png" alt="" width="498" height="278" /></a></p>
<p>Too bad the dialogue doesn&#8217;t tell me the path and file name causing the problem. That would actually have been useful.</p>
<p>In Windows 7, every user has her own personal recycle bin. All recycle bins are located under <code>C:\$Recycle.Bin\</code> and have that user&#8217;s <a href="http://support.microsoft.com/kb/154599/EN-US/">SID</a> as their name. In my case, on my workstation, my recycle bin is:</p>
<pre>C:\$Recycle.Bin\S-1-5-21-3083768501-1260438599-2639843963-5916</pre>
<p>Files in the recycle bin are <a href="http://dereknewton.com/2010/06/recycle-bin-forensics-in-windows-7-and-vista/">represented</a> by two files with a more or less random name, one of which contains the file&#8217;s data. The other one contains meta data such as the original file name and deletion date. When the object to delete is in fact a directory tree, instead of the data file there will be a directory with a random name. This directory contains the original files and subdirectories that were deleted.</p>
<p>A complete path and file name in Windows 7 can only contain <a href="http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx#maxpath">260 characters</a>,  excluding the drive letter, colon and backslash. But as you can see, my recycle bin already takes up 60 of those. This means that any directory tree longer than 200 characters won&#8217;t fit into the recycle bin.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/04/01/recycle-fail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows 7: still an inconsistent mess</title>
		<link>http://www.diederickdevries.net/blog/2011/03/31/windows-7-still-an-inconsistent-mess/</link>
		<comments>http://www.diederickdevries.net/blog/2011/03/31/windows-7-still-an-inconsistent-mess/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 17:09:07 +0000</pubDate>
		<dc:creator>diederick</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[backslash]]></category>
		<category><![CDATA[bad bad microsoft]]></category>
		<category><![CDATA[driveletters]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.diederickdevries.net/blog/?p=637</guid>
		<description><![CDATA[Since I started at my new job, I have been working on a Windows 7 workstation. That&#8217;s not because I have to. I could install Linux on that machine if I wanted to. Still, most of the world, including many clients of the company I work for, use Windows machines, so I&#8217;m forcing myself not [...]]]></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%2F31%2Fwindows-7-still-an-inconsistent-mess%2F&amp;title=Windows%207%3A%20still%20an%20inconsistent%20mess" 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>Since I started at my new job, I have been working on a Windows 7 workstation. That&#8217;s not because I have to. I could install Linux on that machine if I wanted to. Still, most of the world, including many clients of the company I work for, use Windows machines, so I&#8217;m forcing myself not to take the easy path and try to deal with it.</p>
<p>But it&#8217;s hard. Windows is still an inconsistent mess. Take for instance these two consecutive lines from Eclipse&#8217;s console log, showing JBoss startup messages:</p>
<pre>09:47:31,958 INFO  [ServerImpl] Server Base Dir: C:\jboss-5.1.0.GA\server
09:47:31,958 INFO  [ServerImpl] Server Base URL: file:/C:/jboss-5.1.0.GA/server/</pre>
<p>Do you see what I mean? Regardless of their context, the forward and backward slashes really mean the same thing. And in the file URL there are two colons, no more than three positions from each other, with different meanings.</p>
<p>Stupid.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.diederickdevries.net/blog/2011/03/31/windows-7-still-an-inconsistent-mess/feed/</wfw:commentRss>
		<slash:comments>2</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_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>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_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>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>
	</channel>
</rss>

