StokeBloke.com

Archive for the ‘Linux’ Category

Minecraft 1.8.2 – ArrayIndexOutOfBoundsException at LinuxDisplay.getAvailableDisplayModes()

Thursday, February 19th, 2015

I tried to play minecraft 1.8.2 this evening, only to have it crash on every startup with :

Time: 19/02/15 18:58
Description: Initializing game

java.lang.ExceptionInInitializerError
        at avf.ar(SourceFile:560)
        at avf.am(SourceFile:361)
        at avf.a(SourceFile:310)
        at net.minecraft.client.main.Main.main(SourceFile:124)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes(LinuxDisplay.java:951)
        at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:738)
        at org.lwjgl.opengl.Display.(Display.java:138)
        ... 4 more

The cause seems to be the move from lwjgl 2.9.1 to 2.9.4 with Minecraft 1.8.2.

After a lot of debugging and swearing from me, Steve found out that it was an issue with my dual monitors. Installing xrandr fixes lwjgl and then allows minecraft to start.

The issue comes from this line in the XRandR class which doesnt throw any exception when the command isnt available.  Parsing command line output from a child process in Java is really a bad idea.

Warning

/**
* Utility for working with the xrandr commmand-line utility. Assumes
* xrandr v1.2 or higher.
*/

Disable ipv6 on mint/ubuntu

Thursday, February 5th, 2015

How to disable ipv6 on ubunut distros

Edit the sysctl.conf file

sudo emacs /etc/sysctl.conf

append the following to the end of the file

# IPv6 disabled
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Reload sysctl config

sudo sysctl -p

Now checks its gone by running ipconfig

eth0   Link encap:Ethernet HWaddr e0:db:55:bc:1e:bb 
       inet addr:192.168.0.133 Bcast:192.168.0.255 Mask:255.255.255.0
       UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
       RX packets:429875 errors:0 dropped:0 overruns:0 frame:0
       TX packets:154053 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000 
       RX bytes:300878637 (300.8 MB) TX bytes:17446275 (17.4 MB)

Crazy mouse speed fix

Tuesday, January 6th, 2015

I recently bought a Logitech Business Mouse but when I plugged into my desktop (running Gentoo Linux) it was running at ludicrous speed.

When I opened the “Mouse and Touchpad” UI and tried changing the Acceleration down from 2.0 to 0.1.

Default XFCE mouse speedThis made the mouse better but I didn’t like how it felt.  I cant really describe what was wrong with it.

I found this blog which said I could enable “Constant Deceleration” to fix this issue so I ran :

xinput --list

which lists the core pointers

Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech USB Optical Mouse              	id=12	[slave  pointer  (2)]

I then ran :

xinput -set-prop "Logitech USB Optical Mouse" "Device Accel Constant Deceleration" 2.5

which slows down the 800dpi to be closer to my older mouse.    This meant the mouse was working the same my old Dell one but it wasnt being remembered after a reboot.

Created /etc/X11/xorg.conf.d/50-mouse-acceleration.conf with the following contents

Section "InputClass"
   Identifier "Logitech USB Optical Mouse"
   MatchIsPointer "true"
   MatchProduct "Logitech USB Optical Mouse"
   Option "ConstantDeceleration" "2.5"
EndSection

Note : sudo emerge -av x11-apps/xinput

Robert Muths Better Bash Scripting

Sunday, April 20th, 2014

http://robertmuth.blogspot.de/2012/08/better-bash-scripting-in-15-minutes.html

After using bash for years, its still good to learn new things 🙂

Most of my scripts still use back ticks too.  I should really get around to fixing them soon along with everything else on my long todo list.

Xfce menu customisation guide

Monday, May 27th, 2013

I use Xfce all the time at home and I rdesktop into loads of different computers. Over time I have created many desktop entries for rdesktop connections to many different computers.

E.g.

[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Exec=rdesktop -d <domain>; -z -u <username> -g 1670x1025 <hostname> -k de
Icon=chardevice
StartupNotify=false
Categories=Network
Name=RDesktop(hostname)
Comment=RDesktop(hostname)

Each entry I created needed to be created in the ~/.local/share/applications directory. These are then automatically loaded and added to the Network sub menu. (The list of main categories is listed here)

I started to get problems after adding 12+ desktop entries to the Network menu. With the standard Network entries and my custom rdesktop entries it was getting very tall and messy.

I then started to look into if I could move the rdesktop commands into its own submenu separating them out.

I found that I could make general changes to the menu layout via the menu file.   On my distribution its located ~/.config/menus/xfce-applications.menu

Simply create a new submenu

    <Menu>
      <Name>RDesktop</Name>
      <Directory>rdesktop.directory</Directory>
      <Include>
         <Category>RDesktop</Category>
      </Include>
    </Menu>

and include this in the main Layout section

    <Layout>
        <Filename>exo-terminal-emulator.desktop</Filename>
        <Filename>exo-file-manager.desktop</Filename>
        <Filename>exo-mail-reader.desktop</Filename>
        <Filename>exo-web-browser.desktop</Filename>
        <Separator/>
        <Menuname>RDesktop</Menuname>
        <Separator/>
        <Menuname>Settings</Menuname>
        <Separator/>
        <Merge type="all"/>
        <Separator/>
        <Filename>xfhelp4.desktop</Filename>
        <Filename>xfce4-run.desktop</Filename>
        <Filename>xfce4-about.desktop</Filename>
        <Filename>xfce4-session-logout.desktop</Filename>
    </Layout>

The rdesktop.directory entry in the submenu points to a file in the .local/share/desktop-directories/rdesktop.directory desktop file. This mainly defines the menu icon and a few other things. It looks like this

[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Exec=rdesktop
Icon=chardevice
StartupNotify=false
Categories=X-XFCE;RDesktop
Name=RDesktop
Comment=RDesktop

I then updated the individual desktop files to use the new group.

I.e Categories=Network;RDesktop

[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Exec=rdesktop -d <domain>; -z -u <username> -g 1670x1025 <hostname> -k de
Icon=chardevice
StartupNotify=false
Categories=<b>RDesktop</b>
Name=RDesktop(hostname)
Comment=RDesktop(hostname)

Dont forget to read http://wiki.xfce.org/howto/customize-menu too.