Monday, October 28, 2013

Pair programming

I was looking at a job description at a place I'd really like to work.  Everything about it sounded great, but it also said this:

'We pair program all day, every day because we know it delivers remarkable results.'

I have a number of concerns about pair programming.  Wouldn't there be a suffocating lack of privacy?  How can you get in the 'zone' with someone right there yammering at you?

What about when you're doing something other than coding?  At my previous job I was assigned to work on some code that was new to me.  It used an ancient proprietary framework that I wasn't that familiar with.  I spent about a week researching to understand the existing code.  If my pair programming partner knew the answers to all of my questions, great, but otherwise, how would two people effectively work on a problem like this at the same time?  Maybe it's just my imagination failing but this doesn't seem like it would work.

Here's two 'pro' articles:

I love Pair Programming
First Impressions of Paired Programming

And a 'con' article:

Why I Don't Like Pair Programming (and Why I Left Pivotal)

I decided to go ahead and apply.  I feel like this is something I need to learn to flesh out my experience and become a well-rounded developer.

Wednesday, October 23, 2013

Spring Web Flow

I was looking for something to walk me through Spring Web Flow in easy stages.
There's nothing on the snazzy new Guides page.

This was pretty good:

Spring Web Flow 2 Tutorial by Ivan A Krizsan

It's slightly retro (2010), but I found it pretty easy to follow and everything worked.

To get access to the Maven 'webapp-jee5' archetype, I needed to configure the Maven Central catalog as described here

Update: The Spring Web Flow chapter in Spring in Action is really good.  It's not free, though.

Working example at my Github repo.

Monday, October 14, 2013

I'm on Github

I've used Github for work-related stuff, so, not that big a deal, but this is my first personal Github repo:

This is my Spring and Hibernate playground.  It's a Pokemon-related app.  It's nowhere near finished (though I've been working on some version of this on and off since 2010).

I'm hoping this will be useful when prospective employers ask for code samples.  It's often a problem producing code that is 100% purely mine from work.  Plus we sure aren't doing a lot of Spring and Hibernate at my day job.

Saturday, September 14, 2013

HP Envy 17t-j000 (5) (hybrid graphics)

Note: skip down to 'Update 9/28' for the successful way to get hybrid graphics working.

Today I tried installing from Nvidia Drivers.  It went all the way through installation without errors (other than a message about not being able to run some preinstall script).  And now I can use 'optirun'.  'optirun glxgears' reports 800 FPS instead of the 60 FPS it was reporting before.

I can't run glxgears without optirun any more.  It says
% glxgears
Xlib:  extension "GLX" missing on display ":0.0".
Error: couldn't get an RGB, Double-buffered visual

Here's what inxi is saying now:

% inxi -Gxx
Graphics:  Card: Intel Haswell Integrated Graphics Controller 
    bus-ID: 00:02.0 
X.Org: 1.13.3 drivers: intel (unloaded: fbdev) FAILED: 
    vesa Resolution: 1920x1080@60.0hz 
GLX Renderer: N/A GLX Version: N/A Direct Rendering: N/A

% optirun inxi -Gxx 
Graphics:  Card: Intel Haswell Integrated Graphics Controller 
    bus-ID: 00:02.0 
X.Org: 1.13.3 drivers: intel (unloaded: fbdev) FAILED: 
    vesa Resolution: 1920x1080@60.0hz 
GLX Renderer: GeForce GT 740M/PCIe/SSE2 GLX Version: 4.3.0 
    NVIDIA 319.49 Direct Rendering: Yes

800 FPS? That seems a little on the slow side... the ATI Radeon HD 6770 on my desktop computer gets over 10,000 FPS.

When I was trying to run the install script (, the first error it gave me was the 'You do not appear to have an NVIDIA GPU supported by the NNN.NN NVIDIA Linux graphics driver'.  Then it gave me a second error to the effect that I couldn't install the driver with X already running.  But when I rebooted in 'text' mode, both of these errors went away.  So, they really mean it about turning off your X server to install the driver, but more importantly, the error message is misleading.  I wonder if when I was trying this a month ago if I ever tried shutting X off, or did I just see the  'You do not appear to have an NVIDIA GPU' error and give up?

I reconfigured the few games I occasionally play on this computer to use 'optirun'.  Everything looks good except for 'pinball', which gets an error like this:
ERROR: object '' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: object '' from LD_PRELOAD cannot be preloaded: ignored.
Initing SDL

0 joysticks were found.
Couldn't set video mode: Couldn't find matching GLX visual

Looks like totem is an OpenGL application.  So when I just put a DVD in the drive, I guess it's not going to play.  How can I configure totem and other apps that I'm not running from a launcher on the desktop to use optirun?

I thought  vlc might work now with optirun, but no... still just a solid green screen.

 I was getting ready to update all the OpenGL apps in my xscreensaver config file, but looks like there's more to it than that.  Screen saver 'hacks' fail with an error like
superquadrics: root window's visual 0x20 does not support the GLX extension.
But note that 'optirun superquadrics' from the command line works fine.

I tried this:
sudo apt-get install --reinstall xserver-xorg-video-intel 
    libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core
to get the Intel OpenGL graphics working again. That worked, but Nvidia graphics went away. I reinstalled the Nvidia driver, which fixed Nvidia but broke Intel again.

The problem is that there are conflicts between the two drivers, particularly the OpenGL library:
Smxi was frequently helpful for getting me back to a known-good configuration with just the Intel driver and OpenGL working.

One more useful resource:  Listing of Installed Components from NVIDIA Accelerated Linux Graphics Driver README and Installation Guide.

Update 9/28:

I tried this again using the xorg-edgers repo as described here and this time everything worked.  I'm not sure what I did different, except maybe installing nvidia-25 and bumblebee at the same time?  Whew.  I put many hours into this, but in the end the solution was pretty simple.  When I was beating my head against a brick wall trying to get it to work with the driver from Nvidia's web site, I kept thinking about this and wondering if the conflicts would go away if I was installing the Intel and Nvidia drivers from the same repo.  Looks like the answer was yes.

The only major feature I still don't have working in Linux is Beats Audio.

Tuesday, August 20, 2013

HP Envy 17t-j000 laptop (4) (misc)

A few miscellaneous remarks and observations:
  • The default marco window manager is working fine.  First time for me, but this is Mint 15 instead of the Mint 13 I've been using in the past.  I also gave compiz a quick try; it seems stable.
  • Problems with hibernate.  About one time out of three, resume from hibernate fails with a hideous kernel stack trace.  I tried uswsusp; resume from s2disk always fails (hangs after displaying the 'splash').  Suspend (which is mostly what I use) seems OK.  I was a little surprised to see it resume from suspend if I close the lid and then open it again.  I guess I can live with just suspend.  This is actually pretty cool once I got used to it.  Use Power Management to configure On Battery Power -> When laptop lid is closed -> Suspend.  Then close the lid to suspend and open it to resume.  Still, I would like to get hibernate working so I could switch to Windows and back without losing my whole Linux session.
  • Problems playing a DVD.  I got this working following RestrictedFormats/PlayingDVDs.  The two specific things I needed to do were to set a region on my DVD player using regionset, and to delete my old $HOME/.dvdcss.  To make vlc work, I need to use 'vlc -V x11'.  With volume turned up to 100%, it's borderline audible, but that seems to be true of all applications that use sound.
  • Similar issues just playing a movie file.  Totem is fine.  vlc needs '-V x11'.  Audio volume is too low.
  • The touchpad is awful.  By default there was no way to get a middle button click.  I was able to configure this as described here
  • Just in case anyone is tempted to take the easy way out and just use Windows 8: German government warns key entities not to use Windows 8.
  • Disregarding the warnings of the German government, I installed Steam on Windows 8 and downloaded a bunch of games I already was playing on Windows XP.  Everything seems to work OK.  Frustrating to see Windows 8 easily accessing the Nvidia GPU.

Saturday, August 17, 2013

HP Envy 17t-j000 laptop (3) (hybrid graphics)

This computer uses hybrid graphics.

When X comes up, graphics are being rendered by the Intel Integrated Graphics Processor (IGP).  Glxgears gets about 60 FPS.

Linux detects the  Dedicated Graphics Processor (DGP):

 # lspci | grep -i nvidia
01:00.0 3D controller: NVIDIA Corporation GK208M [GeForce GT 740M] (rev ff)

The first thing I looked into was vga_switcheroo.  The kernel was built with this feature enabled:
# uname -r
# grep -i switcheroo /boot/config-3.8.0-27-generic
However, the key directory that vga_switcheroo uses for everything does not exist:
# ls /sys/kernel/debug/vgaswitcheroo
ls: cannot access /sys/kernel/debug/vgaswitcheroo: No such file or directory
The /sys/kernel/debug directory does exist:
# ls /sys/kernel/debug
acpi       cleancache  gpio       kprobes  pwm             suspend_stats   x86
bdi        dri         hid        kvm      regmap          tracing
binder     extfrag     ieee80211  mce      regulator       usb
bluetooth  frontswap   iwlwifi    mmc0     sched_features  wakeup_sources 
I saw some messages like this in /var/log/syslog:
VGA switcheroo: detected Optimus DSM method \_SB_.PCI0.GFX0 handle
I couldn't find anything in the information available from HP about this computer using Optimus, but I decided to consider the possibility. So I installed Bumblebee.  Bumblebee fails with an error like ' Cannot access secondary GPU - error: Could not load GPU driver'.

I soon found that regardless of Bumblebee, the driver just wouldn't load.
# modprobe nvidia-304
ERROR: could not insert 'nvidia_304': No such device
Error (edited for legibility) from /var/log/syslog when this happens:
nvidia: module license 'NVIDIA' taints kernel.
nvidia 0000:01:00.0: power state changed by ACPI to D0
nvidia 0000:01:00.0: enabling device (0000 -> 0003)
NVRM: The NVIDIA GPU 0000:01:00.0 (PCI ID: 10de:1292)
NVRM: installed in this system is not supported by the 304.88
NVRM: NVIDIA Linux driver release.  Please see 'Appendix
NVRM: A - Supported NVIDIA GPU Products' in this release's
NVRM: README, available on the Linux driver download page
NVRM: at
nvidia: probe of 0000:01:00.0 failed with error -1
NVRM: The NVIDIA probe routine failed for 1 device(s).
NVRM: None of the NVIDIA graphics adapters were initialized!
This page suggests loading a more up to date nvidia driver from ppa:xorg-edgers/ppa.  I tried nvidia-325 from xorg-edgers; still wouldn't load.
Note that if you configure the xorg-edgers repository, it might be difficult to remove it afterwards.  There are some instructions how to do this, but it didn't work for me and I wound up recovering my root file system from backups.

I tried nouveau.

I tried downloading the latest driver from the Nvidia web site.  The web site specifically says this supports the GeForce GT 740M, but I was still unable to load the driver.  Error is:
You do not appear to have an NVIDIA GPU supported by the 319.32     
NVIDIA Linux graphics driver installed in this system.  For further 
details, please see the appendix SUPPORTED NVIDIA GRAPHICS CHIPS in 
the README available on the Linux driver download page at  
It feels like there's something fundamental I don't understand about this... maybe something about this hybrid graphics environment is preventing the driver from being loaded, even when it's the right driver.

Saturday, August 10, 2013

HP Envy 17t-j000 laptop (2) (dual boot Linux install with UEFI)

The new laptop arrives.  Here are some highlights:

HP ENVY 17t Quad
    Windows 8 64
    4th generation Intel(R) Core(TM) i7-4900MQ Processor
    NVIDIA GeForce GT 740M Graphics with 2048MB of dedicated video memory
    17.3-inch diagonal Full HD Anti-glare LED-backlit Display (1920 x 1080)
    16GB DDR3 System Memory (2 Dimm)
    2TB 5400 rpm Dual Hard Drive
    Blu-ray player & SuperMulti DVD burner
    HP TrueVision HD Webcam w/ integrated digital mic
    802.11b/g/n WLAN and Bluetooth(R)

I replaced the second 1TB hard drive with a 250GB SSD, to give me SSD performance on the root file system and my home directory.

The UEFI architecture poses some challenges to doing a dual-boot install.  The following represents something like 3 days worth of research.  I hope this will spare someone else all this trouble.  UEFI is supported by Linux, but it's relatively new and there are some things to get used to.

This all kind of assumes you care about keeping Windows 8.  I read many accounts of people who cheerfully blew away Windows which would certainly make this a lot easier.

I punted on secure boot.  Ubuntu in particular seems to have solved this problem, if you really care about secure boot.
  • (optional, recommended) Burn your recovery disks.  If you're super-paranoid like me, you'll then use those to reinstall Windows 8 on a different drive, and test all of the following on that drive, before proceeding.
  • In the BIOS, disable Secure Boot.
  • Enable 'Legacy Support' in Boot Options. 
  • Boot System Rescue.  Run gparted and delete the recovery partition.
  • Boot Windows 8.  Use compmgmt.msc (run as administrator) to shrink the 'C:' drive partition.  I left my Windows 8 C drive at 200 GB leaving over 700 GB available for Linux.
  • Boot Linux distro.  Mint 15 MATE 64 bit is what worked for me.  I couldn't get Mint 13 or Ubuntu 12.04 to work.  Use the 'compatibility mode' line.  Choose 'Install Linux Mint alongside Windows 8' or 'Something Else'.  Finish the install.
  • At this point, rebooting brings Windows 8 up by default.
  • Reboot.  Choose 'Boot From EFI File' and navigate down the tree to 'NO VOLUME LABEL/EFI/linuxmint/grubx64.efi'.
  • X login menu comes up, but it's almost invisibly dim.  Once I log in (blindly), brightness increases to normal.  Alternatively, when the GRUB menu comes up, hit 'e' for edit and add 'acpi_backlight=vendor' (no quotes) to the boot line (line that starts with 'linux').
  • Install 'boot repair' and run it.  Click on 'Recommended repair'.  Reboot.
  • GRUB should now come up when you reboot.  It looks weird... I have 16 choices.  (Awe your co-workers with your 733t boot menu!)  Linux boot should work.  'Windows 8 (loader) (on /dev/sde4)' or 'Windows Recovery Environment (loader) on /dev/sda5' got me an error like this:
error: can't find command 'drivemap'.
error: invalid EFI file path.
  • I tried to fix this following these instructions, but unsuccessfully.  However, I'm able to boot Windows 8 with 'Windows Boot UEFI loader'.  Good enough.
  • Next, configure GRUB to add 'acpi_backlight=vendor' always at boot time. I went to edit /etc/default/grub but no such file exists.  After a bit of googling, I installed grub-efi-amd64 which provides this file.  This seems like a bit of a MINT bug for this file not to be present.
  • Edit /boot/default/grub.  Add this setting

(see Simple Configuration Handling) and rebuild the GRUB configuration:

grub-mkconfig -o /boot/grub/grub.cfg

Now you should be able to boot Linux from the GRUB menu and see the login prompt when it comes up.

Wednesday, July 17, 2013

HP Envy 17t-j000 laptop (1) (flaming HP)

Update 10/28/2013: A guy contacted me by email claiming that the correct parts to install a second hard drive are  720237-001 'HDD Hardware Kit' and 720260-001 'Screw'.
Wow.  Wow.  Wow.
It's really hard to express my experience with HP and their customer support without cursing.  Picture a torrent of drill-sergeant profanity in place of all the words of this blog post, without any repetition.  I used to like HP a lot, but I swear this is the last time I will ever buy anything from them.

I ordered a new laptop on 7/2 using my employee discount.  It arrived on 7/15 (they build them in China).  One of the selling points of this hardware for me is the second hard drive bay.  I wanted to use their HP-supplied drive in one bay and my own SSD, purchased separately, in the second bay.  Or, if that had been one of their options, I would have totally bought it configured that way from HP, but it wasn't.  Weirdly, for this otherwise high-end performance hardware, all they sell is 5400 RPM hard drives.

The computer arrives, and it is lacking some hardware, mainly a cable, to connect up that second hard drive.  If this were a desktop, it would be a standard SATA cable, but this is an HP proprietary cable that you can't just buy at Micro Center for $10.  I had read some reviews of this PC, or probably a similar model, stating that the computer did not come equipped to hook up a second drive, and that you needed to purchase a kit from HP to allow this.  I was kind of incredulous that they would do this, but I went ahead and started trying to order this component to make it possible to hook up a second drive.

So, I call HP Parts Store, tell them what I want, and they sell me a $70 part.  The part arrives (665909-001 'Hard Disk Drive hardware kit'), and it's the wrong part.

I get on the phone with HP Parts Store again, RMA the first part, and discuss with them what is the part I really need.  We are being more careful this time, but after some discussion we think we have identified the right part this time, and I order that (603772-001 'SPS-HDD hardware kit').  The ($90) part arrives, and again it's the wrong part.

Again I get on the phone with HP.  I spend quite a long time this time, 90 minutes or 2 hours, speaking to various people at the parts store and tech support.  Everyone assures me that the part I have is the correct one.  I don't work on laptops much but I'm 99% sure that this SATA cable simply doesn't fit the connector on the laptop.  But there's a tiny speck of doubt in my mind that there's some secret way I just can't see.

I call up a local business that has worked on my HP laptops in the past.  (Incidentally, if you are local to the Denver area and need service for business or personal computers, check out ProTech, they rock).  They tell me, sure, we'll look at it and get this sorted out.  So I drop the hardware off with them.  A few hours later they report back.  Yes, the part they sent me is wrong.  Their technician who actually called HP is very frustrated because now he's spent hours on the phone getting the runaround from HP, too.  To make a long story short, HP does not sell a part to allow you to install a second hard drive in this laptop if it was assembled at the factory with a single hard drive.  The option they offer me is to RMA the whole laptop, buy another laptop configured with a second hard drive, remove the second hard drive and replace it with my SATA drive.  I've lost over 2 weeks and I'm loath to consider this at first, so we went back and forth a bit, but in the end this seemed like the only option.  So now I'm waiting on another 2 week cycle for them to build almost the identical computer in China and ship it back to Denver, to get a $10 cable.  So, about 6 weeks (and many hours of aggravation) from the original purchase I'll have my computer, if all goes well.

HP customer support is the absolute pits.  I constantly would call one number (e.g. parts store), they would badger me with a bunch of personal questions like name, address, phone, email, then forward me to someone else (e.g. tech support), they'd ask me the same questions, then forward me somewhere else (HP Home and Office), lather, rinse, repeat.  It took me over an hour to RMA one part.

I have a bunch of disorganized notes on technical issues like UEFI and Hybrid Graphics.  Details of getting all this working for Linux was going to be the topic of this post before this issue with the drive blew up in my face and overrode all other considerations.  Check back around mid-August, I guess.

Saturday, March 2, 2013

Chastise users who disable Javascript

Here's an example:

Yes, I know about writing pages whose functionality degrades gracefully if Javascript is disabled.  But sometimes you just want to convey to a user: Javascript is here to stay.  Get over it.