Wednesday, February 29, 2012

Packet drops in Ubuntu and Fedora with Realtek NIC driver r8169

The Problem
I recently purchased a Gigabyte GA-Z68X-UD4-B3 motherboard, installed Ubuntu and started to download eclipse.  The download took forever!  Tried to open a few websites and some of them just timed out.  I was just about to get on the phone with the ISP when I noticed doing a ping the router some packets where being lost!

The solution
The motherboard comes with a Realtek network card running the r8169 chip.  Now for some reason Ubuntu and Fedora detects this as a r8168.

To check this run:
lsmod | grep r8168
If you get a output if means your using the r8168 driver instead of the r8169.

Step one is to download the driver required from Realtek

Once the download is complete extract
tar vjxf r8168-8.tar.bz2
The next step will disable the network interface, remove the r8168 module.
sudo rmmod r8168
Now run the file in the extracted folder
sudo ./
Blacklist the r8168 module form being loaded again you will have to add it to the blacklist
sudo gedit /etc/modprobe.d/blacklist.conf
Add the following line:
blacklist r8169
Update the driver cache
sudo update-initramfs -u
Now to check that everything went according to plan run
lsmod | grep r8168
If you get a output your done and dusted!

Monday, February 27, 2012

LXDE HDMI as default audio output device

The Problem:

If you are have a old pc running a lightweight linux interface like LXDE or XFCE, e.g LUbuntu and need to get the audio out to work via the HDMI you most probably have notices there is not a nice GUI to do this like in Ubuntu.

The Solution:

pavucontrol is a great and simple solution.  I know it is a bit heavyweight since you have to install pulseaudio but it is the easiest solution I have found.  To install:
sudo apt-get install pulseaudio pavucontrol
then to run

Thursday, February 16, 2012

Cannot create Seam component, scope is not active

The problem:

I kept on running into to following error:
WARN  [org.jboss.seam.Component]  Cannot create Seam component, scope is not active: mySuperAction(CONVERSATION)
SEVERE [javax.enterprise.resource.webcontainer.jsf.lifecycle] JSF1054: (Phase ID: RESTORE_VIEW 1, View ID: /ThePage.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@19da36b]

Seam said my long-running conversation was gone.  But how could this be!  Well after a lot of digging I found this hidden line in the Seam documentation:

Conversational components have one minor limitation: they cannot be used to hold bindings to JSF components. 

What I was doing is I had a DataTable binding in the JSF.  The reason for this is I was not sure what columns or data was going to be displayed for the datatable until the time the page was being generated.

The solution:

As stated in the documentation, move and the HtmlPanelGrid in a new container with scope set to EVENT.
public class Grid
    private HtmlPanelGrid htmlPanelGrid;

    // getters and setters
public class MySuperAction
    private Grid grid;
    private void populateTable(){....}

Add to the page.xml a new action that calls the populateTable:
<action execute="#{mySuperAction.populateTable}" />
Now for the binding:
<h:panelGroup id="dynamicTablePanel" binding="#{grid.htmlPanelGrid}" />
Just as a note I found in a few forum posts where made where they stated adding getters and setters for the Grid on the MySuperAction thus making the binding look like this:

 <h:panelGroup id="dynamicTablePanel" binding="#{mySuperAction.grid.htmlPanelGrid}" />
This will work until you do your first AJAX call on the page and you will be hit with a nice RESTORE_VIEW error.