Saturday, September 21, 2013

Conky Config

(Update 25-Oct-2014: Slightly updated version posted.

Just installed conky and looked around for some cute configs. This one by asoliverez looked nice, so I grabbed it and started playing around.

It didn't quite work for all values, since I didn't have all the pre-requisite software installed. So I hacked it up a little bit, and came up with the following that works with sensors (I worked out how to do it using this guy's example as a template), nvidia-smi (since I've got an nVidia GPU installed) and my particular file systems setup:

File: .conkyrc

background no
font Sans:size=8
#xftfont Sans:size=10
use_xft yes
xftalpha 0.9
update_interval 5.0
total_run_times 0
own_window yes
own_window_type normal
own_window_argb_visual true
own_window_transparent yes
#own_windiw_class conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# To make conky always on top, swap 'below' in above line to 'above':
#own_window_hints undecorated,above,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 220 5
maximum_width 220
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
default_color CDE0E7
default_shade_color black
default_outline_color green
alignment top_right
gap_x 12
gap_y 35
no_buffers yes
uppercase no # set to yes if you want all text to be in uppercase
cpu_avg_samples 2
override_utf8_locale no

TEXT
${color white}SYSTEM ${hr 1}${color}

Hostname: $alignr$nodename
Kernel: $alignr$kernel
Uptime: $alignr$uptime
MB Temperature: ${alignr}${iconv_start UTF-8 ISO_8859-1}${exec sensors|grep 'Physical id 0'|awk '{print $4}'}${iconv_stop}
CPU Temperature 0: ${alignr}${iconv_start UTF-8 ISO_8859-1}${exec sensors|grep 'Core 0'|awk '{print $3}'}${iconv_stop}
CPU Temperature 1: ${alignr}${iconv_start UTF-8 ISO_8859-1}${exec sensors|grep 'Core 1'|awk '{print $3}'}${iconv_stop}
CPU Temperature 2: ${alignr}${iconv_start UTF-8 ISO_8859-1}${exec sensors|grep 'Core 2'|awk '{print $3}'}${iconv_stop}
CPU Temperature 3: ${alignr}${iconv_start UTF-8 ISO_8859-1}${exec sensors|grep 'Core 3'|awk '{print $3}'}${iconv_stop}
Fan 1: ${alignr}${hwmon 1 fan 1} RPM
Fan 2: ${alignr}${hwmon 1 fan 2} RPM
#Battery: ${alignr}${battery_percent BAT0}%
CPU: ${alignr}${freq} MHz
GPU Temp: ${alignr}${exec nvidia-smi | grep '. ..\% ..C'|awk '{print $3}'}${iconv_start UTF-8 ISO_8859-1}°${iconv_stop}C
Processes: ${alignr}$processes ($running_processes running)
Load: ${alignr}$loadavg

CPU1 ${alignr}${cpu cpu1}%
${cpubar cpu1}
CPU2 ${alignr}${cpu cpu2}%
${cpubar cpu2}
CPU3 ${alignr}${cpu cpu3}%
${cpubar cpu3}
CPU4 ${alignr}${cpu cpu4}%
${cpubar cpu4}

Ram ${alignr}$mem / $memmax ($memperc%)
${membar 4}
swap ${alignr}$swap / $swapmax ($swapperc%)
${swapbar 4}

${color gray}Highest CPU $alignr CPU% MEM%${color}
${top name 1}$alignr${top cpu 1}${top mem 1}
${top name 2}$alignr${top cpu 2}${top mem 2}
${top name 3}$alignr${top cpu 3}${top mem 3}

${color gray}Highest MEM $alignr CPU% MEM%${color}
${top_mem name 1}$alignr${top_mem cpu 1}${top_mem mem 1}
${top_mem name 2}$alignr${top_mem cpu 2}${top_mem mem 2}
${top_mem name 3}$alignr${top_mem cpu 3}${top_mem mem 3}

${color white}Filesystem ${hr 1}${color}

Root: ${alignr}${fs_used /} / ${fs_size /}
${fs_bar 4 /}
Files: ${alignr}${fs_used /files} / ${fs_size /files}
${fs_bar 4 /files}

${color white}NETWORK ${hr 1}${color}

Eth0: ${addr eth0}
Down ${downspeed eth0} k/s ${alignr}Up ${upspeed eth0} k/s
${downspeedgraph eth0 25,107} ${alignr}${upspeedgraph eth0 25,107}
Total ${totaldown eth0} ${alignr}Total ${totalup eth0}

Wlan0: ${addr wlan0}
Signal: ${alignr}${wireless_link_qual wlan0}%
Down ${downspeed wlan0} k/s ${alignr}Up ${upspeed wlan0} k/s
${downspeedgraph wlan0 25,107} ${alignr}${upspeedgraph wlan0 25,107}
Total ${totaldown wlan0} ${alignr}Total ${totalup wlan0}

(Text wrap doesn't work real well...sorry. It should cut and paste okay though if anyone is interested in it).

(Update 23-Dec-2013: Added option to keep conky "always on top").

(Update 27-Sep-2014: Fixed CPU bar always showing same % issue).

Looks pretty good sitting there over in the corner of the screen:

Sunday, September 15, 2013

Fixing Tearing with Kubuntu 13.04 and nVidia 304.88

UPDATE 26th May 2014: I tried this same fix on Kubuntu 14.04, and it black-screened the system. I'd also been tinkering with some other stuff at the same time, so haven't tracked it down exactly (or what the new fix might be), but I suspect it is the GL_YIELD change to /etc/profile below. I don't recommend doing it unless you're ready to rollback/recover the original.. UPDATE 20th Oct 2014: Tried a very similar fix on 14.04 and this time it worked, so not sure what was going on here.

After finding a workaround to fix tearing on Mint 15 Cinnamon, I jumped to Kubuntu 13.04 because there were some strange issues with screen recording in Mint, I assume because of the tearing workaround affected some of the internals in the graphics stack that screen capture uses.

Unfortunately, Kubuntu had the same tearing issue that Xubuntu exhibited. The solution again was a workaround, but different:

  • Install KDE 4.11 as per the instructions at this noobslab article:

    sudo add-apt-repository ppa:kubuntu-ppa/backports
    sudo apt-get update
    sudo apt-get dist-upgrade

    (Not sure if this was actually necessary, but it was one of the other things I tried first).
  • In "Desktop Effects -- KDE Control Module" => Advanced tab, set Compositing type to "OpenGL 3.1" and Tearing Prevention (VSync) to "Re-use screen content".
  • Add:

    export __GL_YIELD="USLEEP"

    To /etc/profile as per this KDE forum post. NOTE: But see above regarding this possibly having problems in more recent versions.

That should fix the tearing.

Note on Fullscreen Games

For some reason, the above worked in the general desktop environment, but fullscreen games were still tearing. The fix that worked in that case was to uncheck "Suspend desktop effects for fullscreen windows". Not sure why that made things better, since I would have thought the other way around would work, but that's the change that fixed it.

Things That Didn't Work

For reference, here are the things I tried that didn't work:

  • Turn off compositing with Alt+Shift+F12 (no effect).
  • Install KDE 4.11 (as noted above, this by itself didn't help, but may be necessary for the workaround).
  • Install compiz. The tearing was perhaps a little better, but still not great, and compiz just doesn't look as good as kwin.

And one last resort I would have tried eventually: Re-compiling KDE with this patch.

Running Card Hunter in Linux

I read a recent PAR article on new browser-based game Card Hunter so I signed up to give it a shot.

Unfortunately if you're using Linux and Firefox, depending on the version of the flash player you have installed, it probably won't work.

To get it going I installed Chromium and the Pepper flash plugin, following these instructions (as referenced in the Card Hunter forums). This works perfectly.

Saturday, September 14, 2013

New Linux Install -- Software List

Software and setup for a new distro install:

Setup/Config

  • /etc/fstab SSD tuning
  • Case insensitive bash
  • Copy over .fonts folder
  • Copy over .xsetwacom, .vimrc, .hgrc

Software

  • GPU drivers (if needed)
  • Firefox, plus add-ons:
    • AdBlockPlus
    • NoScript
    • FlashGot
  • Mercurial
  • Thunderbird
  • Gvim
  • KeepassX
  • ia32-libs
  • Handbrake
  • Unetbootin
  • Imagemagick
  • VLC
  • lm-sensors
  • Gimp
  • Krita
  • Eclipse

Optionals/As Needed

  • VirtualBox
  • Wine
  • Wallch
  • SimpleScan
  • k3b, xfburn (or some other DVD burner)

Experimentals

  • Tupi2D
  • recordMyDesktop
  • Vokoscreen

Tuesday, September 10, 2013

Budget Small(ish) Web Browser Box

I wanted a small box to sit in the corner as basically nothing more than a web browser. Since mITX parts were so difficult to source locally, I went the smallest mATX case I could find.

Here is the parts list:
  • CPU: AMD A4-5300 $55
  • Mobo: Asus F2A55M-LK-Plus $49
  • RAM: 1x4GB 1600 (already had)
  • SSD: Plextor M5S 128GB $89
  • Case: Coolermaster RC361 $49
  • PSU: Corsair VS450 $49
  • KB/Mouse: USB combo (already had)

Total: $291 (would have been about $350 if I didn't have RAM/KB/mouse already).

Some happy snaps:

The motherboard, fresh out of the box. Notice how it captures the light...(because of my crappy photography)

The motherboard was fairly low end, but was a good price so I grabbed it. It doesn't have a USB 3 header of SATA 3, but since the build didn't need either, it filled the requirements.

CPU, pins pins pins

Motherboard with RAM, CPU and HSF mounted

Mounting the AMD HSF was straightforward: stick it on the CPU and clip it into place. Easier than Intel's "four pins" mechanism, which takes a little getting used to.

The empty case

The Coolermaster RC361 is about the smallest micro-ATX case I could source locally. It's a "sideways" mini tower, so can stand upright or on its side. For a case that cost less than $50, it's not too bad.

Case with the power supply (tucked away, unusually, in the front of the case)

Mounting the power supply was fairly tricky, and given its unusual location, there's no way to turn the PSU on or off without pulling the front of the case off (which, unlike some cases, came off easily). I don't think access to the PSU switch will prove too much of a problem for my uses. The case also has no place to mount an SSD. Since I didn't have a mounting kit, I just taped it to the bottom of the case. The RC361 does come with a comprehensive set of extra screws and cable ties.

The completed build. SSD isn't visible because it's taped to the bottom of the case

Installed Kubuntu 13.04, it worked really well. The AMD A4-5300 (with proprietary Catalyst drivers installed) will even play some games at a reasonable level (if with low settings).

Sunday, August 25, 2013

Installing SmoothDraw on Linux

At the moment, SmoothDraw is my "one application" that means I have to keep my old dusty Windows box in the corner.

I investigated installing SmoothDraw on Linux under Wine, and the good news is that you can get it to work, but there are caveats.

To start with, the latest version of SmoothDraw (version 4) requires .NET Framework 4.0. I couldn't get this running properly under Wine.

But winetricks can be used to install .NET 3, and with this running you can get SmoothDraw3 to work. The only drawback is that tablet input loses its pressure sensitivity (think it's treated as a regular "mouse-like" device by the wine driver).

An option to get pressure sensitivity working was the SAI (1.5.5) version of wine specifically set up for this. But then I couldn't use winetricks, and only winetricks seems to "know" how to install .NET...

Anyway, having it work allows me to open, view and manipulate existing files, so it's worth having. This is the process for installing SmoothDraw3 under wine 1.4.1 (pieced together from my history...forgot to write it up at the time :/)

$ sudo apt-get install wine
$ export WINEARCH=win32
$ winetricks dotnet35
$ wine SmoothDraw3Setup.exe
$ wine .wine/drive_c/Program\ Files/SmoothDraw/SmoothDraw3.exe

Sunday, August 11, 2013

CSS Holy Grail: Sadness

Saw an article the other day on the "holy grail" of CSS layout: the three column equal height liquid layout.

The sad thing is that after all this time, there isn't a simple pure-CSS solution to this problem that doesn't involve extra divs and hacky behind the scenes manipulation. :(

Saturday, August 3, 2013

DDR3 Dual-Channel vs Single-Channel Performance

It was suggested to me that with modern CPUs/motherboards, running with dual-channel memory was unnecessary because there's no difference. My understanding was there is a modest performance increase in using dual-channel. I decided to do a quick test to see.

For the test I used Handbrake (0.9.9) to transcode a 187MB 1080p video. This isn't a true benchmark because the conditions are maybe too uncontrolled (hence it's a "quick test"), but I thought using a real-world application like transcoding would give an idea of the performance difference if any.

I swapped between a single 4GB RAM stick and 2x2GB sticks. It was in my low-powered HTPC, so it took a while. These are the results:

RAM typeRun #Time taken
1x4GB14m 55s
1x4GB24m 48s
1x4GB34m 49s
 
2x2GB14m 36s
2x2GB24m 37s
2x2GB34m 35s

It works out to about a 5% performance improvement using dual-channel, which is consistent with other things I've read. How that translates from a processor intensive task like transcoding to everyday use I'm not sure, I suspect it would be unnoticeable though.

Rest of the system specs, for reference:

  • OS: Xubuntu 12.04.1 (64-bit)
  • CPU: G2020
  • Mobo: Asus P8B75-M LX
  • RAM: G-Skill NT 1x4GB or G-Skill NT 2x2GB
  • SSD: Kingston V300 60GB
  • HDD: Toshiba 1TB 7200RPM
  • GPU: Gigabyte GT610
  • PSU: Antec EarthWatts 380

Wednesday, July 24, 2013

Patent Killer

Very interesting post by Joel Spolsky on how to get a patent killed.

For anyone interested in writing software and not having to play Russian Roulette with the quagmire of bad patents out there, well worth a read.

(For any software developers out there: hands up who has actually read a patent to learn how to do something?)

Monday, June 17, 2013

Fixing nVidia Graphics Tearing on LinuxMint Cinnamon

So, after installing an nVidia GTX 650TI a while back, I put up with tearing in pretty much all applications because it was easy to install and get going.

But eventually I got sick of it and tried to fix it. After trying about every fix I could find, I jumped to a different distro (from Xubuntu 12.10 to Mint 15) in the hope that might have some effect. It didn't, but I re-tried a fix I thought I'd already tried, and found it eliminated the tearing 100%.

The fix is to add this to the /etc/environment file:

CLUTTER_PAINT=disable-clipped-redraws:disable-culling
CLUTTER_VBLANK=True

This is using the nVidia proprietary driver 304.88. Hope to confirm on other Xubuntu systems whether this fix also works.

Update 20 June 2013:

Unfortunately, the fix only seems to work in Mint/Cinnamon. Title updated to reflect this.

Saturday, June 15, 2013

Fixing "mojo.run: No such file or directory" error

When trying to install something with a .mojo.run extension (for example, I was installing Dungeon Defenders from the Humble Bundle), if you get this error:

mojo.run: No such file or directory

The solution (thanks Kazade!) is to install the ia32-libs package. Then the installer should work.

(Posted this because it took me way too long searching to stumble across Kazade's post).

Update 20/10/2013:

I noticed that ia32-libs is no longer an installation target in 13.10. There doesn't seem to be an easy way to fix this, since some suggested mechanisms don't work when you've got a mojo.run file.

The only way I found to do it is detailed here: http://wiki.phoenixviewer.com/ia32-libs-in-ubuntu-13-10

The version of synaptic I was using was slightly different to that described above. In Step 4, it was "click New" rather than "other software -> add", and in step 5 the values to insert are in four separate lines:

  • Dropdown box: Binary (deb)
  • URI: http://archive.ubuntu.com/ubuntu/
  • Distribution: raring
  • Section(s): main restricted universe multiverse

Monday, June 10, 2013

Fix broken xfce4 desktop after uninstalling compiz

So, to test a theory on how to fix graphical tearing on a Xubuntu 12.04.1 install, I tried installing compiz.

Not only did it not help, but it also broke the desktop environment. So I uninstalled (followed the reverse of the compiz installation steps I did). Uninstalling though doesn't clean up everything, and the desktop was still broken.

Fortunately, I found this post which suggested removing ~/.config and ~/.cache.

You don't need to zap those entire directories though. Inside each one there is a subdirectory that starts with "compiz". Those are the directories that need deleting. After that, I rebooted and the regular xfce4 desktop was working again.

Friday, May 31, 2013

Review: Logitech K400 vs Shintaro Wireless Multimedia Keyboard

I was tossing up between a Logitech K400 and a Shintaro Multimedia (trackball) keyboard for my HTPC. I got the Logitech first for $35, but wasn't entirely happy with it so I got the Shintaro as well ($38+postage) for a comparison. These are their stories...

Shintaro Wireless Media (above) and Logitech K400

My initial reaction was that the Shintaro has a much more solid build than the Logitech. The mouse buttons were clicky and "alive", compared to the gummy feel of the K400 buttons, where you're never quite sure if you've actually pressed it.

The key layout was also much better, and almost for that alone I'd take the Shintaro. The placement of the right shift key and up arrow buttons on the Logitech continually annoyed me. The Shintaro is closer to a "normal" keyboard layout.

Shintaro positives:

  • Solid feel and nice clicky buttons, has a quality about it.
  • The keyboard layout is close to a regular desktop keyboard. Minimal pressing the wrong key when reaching into the shift/enter/arrow key area.
  • I think I prefer the trackball to a touchpad.

Shintaro Wireless Media keyboard

Shintaro negatives:

  • Size of the USB receiver. That thing is enormous. I ended up connecting it via a USB extension cable from the back of the case, because it looked so precarious hanging out the front.
  • Wireless connectivity can perform really badly. Even with a direct line of sight and less than a metre distance, having the keyboard sitting in the wrong place on your knees can mean up to 80\% dropped characters. When it was connected it was fine, but I still haven't quite worked out what positions will cause it to go bad. (Even a direct line of sight < 3m sometimes drops the occasional character when typing).
  • The board "goes to sleep" really quickly. Spinning the trackball doesn't wake it up either, you've got to press a key. I'm so used to bumping the mouse to wake up a computer, it takes a bit to get used to.
  • While the build quality is nice, it is quite bulky.
  • I sometimes had trouble getting into the BIOS with this keyboard.
  • It has a "sync" step you have to perform by pressing a button on the receiver. I seemed to lose sync occasionally, but this may have just been the wakeup problem noted above.
  • Takes four AA batteries, and with an estimated 3 month life, probably falls short of the Logitech in that respect.

Logitech positives:

  • Rock solid wireless connection. I was typing thing in another room with no line of sight.
  • Tiny USB receiver and no need to sync. Just works.
  • Size-wise, the keyboard is nice and compact.

Logitech K400 wireless keyboard

Logitech negatives:

  • The flimsy build quality and gummy feel of the keys and buttons. It just felt really cheap, and was difficult to know when you'd clicked a button.
  • Keyboard layout was problematic. In particular, the Right Shift key is much smaller than normal, with the Up Arrow taking up the space. This means the Up Arrow is easily pressed when searching for the Shift key. Doing any command-line stuff during installation, this was infuriating.

The lengths of the lists don't represent who won in my test, since the negatives to the Logitech K400 and positives to the Shintaro were really big factors in my decision to keep the Shintaro.

Saturday, May 25, 2013

Case Fan Review: Antec TrueQuiet Pro, Aerocool SharkFan and Coolermaster Sickleflow

I started on a vendetta to try and get my computer to run a bit quieter. Although I think the main culprit of noise levels is the stock CPU fan, the case fans in the Corsair 300R were making some noise, so I bought a few other fans to try out.

The fans were:

  • CoolerMaster SickleFlow 120mm ($8)
  • Aerocool SharkFan 120mm Blue Edition ($13)
  • Antec TrueQuiet Pro 120mm ($20)

CoolerMaster SickleFlow (left) and Aerocool SharkFan (right)

I don't have a dB meter -- quantitative testing isn't how I roll -- so I was just going by the ear test.

The CoolerMaster SickleFlow was the cheapest and was pretty loud, louder than the stock case fan.

The Aerocool was initially really loud as well, but then I realised the "extension lead" in the packet for a voltage reducer. With this fitted it reduced the noise to about the same as the stock fan.

The Antec TrueQuiet Pro had a physical switch for adjusting the speed. At full speed it too was louder than the stock fan, but when switched down to low speed it was quieter.

Spending the extra for something like the TrueQuiet Pro is worthwhile if noise levels are important.

Saturday, May 18, 2013

NFS Mount Hangs on Network Between Two Linux Machines

I was trying to set up NFS on my local network to transfer some stuff between two machines. I thought this would be pretty easy, but there seem to be a lot of guides out there that are either out of date or more complicated than they need to be (maybe they include some advanced features, not sure).

The main problem I had was that the mount command would hang when I tried to connect the client to the server. I tried everything I could think of, and in desperation tried reversing the client<-->server direction. At that point, it worked without a hitch. Still don't know exactly what the issue was (some conflict in the setup or configuration of my server machine?), but I was ecstatic at that point it worked at all.

Here are the steps (use ifconfig on each machine to find out their IP address, or use hostnames if you've set up hostnames):

On the nominated "server" machine

  • $ sudo apt-get install nfs-common nfs-kernel-server
  • Edit /etc/exports and add the following line (assuming here that the client IP address is 192.168.1.1 and the directory to be made available is /tmp):
        /tmp	192.168.1.1(rw,sync,no_subtree_check)
    
  • $ sudo exportfs -ra
  • Check that the entry just added to the exports file is okay with: $ sudo exportfs
  • $ sudo service nfs-kernel-server restart

NFS server daemon processes should now be running.

On the nominated "client" machine

Assuming the server IP address is 192.168.1.7 and /files/remote is the directory which we will be mounting to:

  • $ sudo apt-get install nfs-common
  • $ mkdir <local-directory-to-be-mount-point>
  • $ sudo mount -t nfs 192.168.1.7:/tmp /files/remote

An entry to automatically mount can be put in /etc/fstab, but since I will only be using the NFS connection on an ad-hoc basis, I haven't done that at this stage.