Saturday, October 31, 2009

No audio? Is skype running?

I was looking at newly uploaded (from camera) videos of Timmy and John and I was confused because the videos were weird:


      Totem said they where *playing*, but the progress bar wasn't moving and there was neither sound nor video.

      The time counter (shows how many seconds/minutes into the video/song you're in) wasn't moving.

      I thought it was something wrong with the newly mangled videos (made smaller via ffmpeg) so I tried some MP3s. Same symptoms as for the videos.



So I looked around at the modules, and at dmesg. Everything looked good. Until I moved my mouse to the bottom of the screen and the hidden status panel popped up. Skype was running. Apparently, on this machine, it takes over the sound card.

Thursday, October 08, 2009

Slow vim startup -- solved

I've had some frustration due to slow vim startup.

time vim -c 'q'

real 0m6.138s
user 0m0.096s
sys 0m0.024s

Found the solution though. a blog post at samdorr.net says to use -X.

So now I have two new aliases in ~/.bashrc

alias vi="/usr/bin/vi -X"
alias vim="/usr/bin/vim -X"

I was a little confused because the slowness was there in screen, but when I opened a new terminal, there was no slowness (even without the aliases). I think it's because I've restarted X since I started screen. So $DISPLAY in the screen sessions is :0.0, but possibly there's some other X authentication cookies that refer to the old X session. Ok, I just looked, there's an XDG_SESSION_COOKIE, maybe that's it, or if not, something similar. So the X authentication still succeeds, but only after a timeout.

The poster at samdorr had a different problem. His server probably didn't have X at all, or maybe vim is trying to connect via ssh X forwarding, back to his graphical terminal :-). But the solution he gives is an axe that solves my problem too since I don't need vim to talk to X at all.

Hmmm, someday I'll just need to catch up to the modern world and use gvim, and probably syntax highlighting even :-).

Tuesday, October 06, 2009

Vodafone "Vodem" -- very easy

A friend of mine has a vodem (that's a USB HSDPA modem that works with the Vodafone NZ network). I borrowed it and tried it out on my Jaunty (Ubuntu 9.04) laptop at home.

I was confused initially since I had no manual or anything else. My friend said that on windows there's a CD, it installs a bunch of things and then just works. I didn't think to ask if authentication via login/password was required.

After some messing around, I found a hint on ubuntuforums that pointed me in the right direction. NetworkManager in Jaunty automatically detects the modem. It even automatically detects the network. It then presents a dialog asking which country (NZ is already default selected) and which Network to use. There are three networks ("Vodafone", "Vodafone (restricted)", and "Vodafone (unrestricted)"). My confusion was that I chose the first and the modem immediately disconnected.

I should have chosen the third. Upon choosing "Vodafone (unrestricted)", the vodem connects immediately to the Vodafone network and then just works. No further management needed. This is pretty cool. Too bad vodafone data charges are still so high. When the data charges drop by a factor of 10, this will be a real player. For now, it's a nice toy that I'm soon going to return to its rightful owner.

Thursday, October 01, 2009

On recruiting software developers

John Fuex has a great article, 19 Tips for Recruiting Great Developers

Now, not all companies are going to be needing the superstars this article focuses on, but the points made there should be relevant to, say, the top 85-90-95 percent of developers.

Perhaps the tips can be relaxed according to the quality of the developer needed by the company (although the company, HR division or recruiter who is conscious of the actual target percentiles [instead of being hypnotized by some mantra about hiring "only the best"], is likely very rare on the ground).

Friday, September 25, 2009

Switched back to gnome

I had switched to xfce4 in Ubuntu because it gave me some memory savings. I found, however, that on my work desktop, I got *far* more savings by installing and using a 32-bit JDK (and 32-bit eclipse to go with it).

I didn't really need to switch back to gnome, but gnome is a bit smoother than xfce in the total experience, and I found myself using gnome applets in xfce (mainly the user switcher, but some others too).

I didn't switch back to gnome immediately since I *much* preferred xfce's Alt-F2 behavior to gnome's. The application chooser is much smarter even than Gnome-do. But then I realized that I could use xfrun4 in gnome. And after testing that at work, I've switched to gnome+xfrun4 at home too.

I forgot how I was running firefox as another user for security :-). After some fumbling, I figured it out again (although, really, I should just have logged back into xfce and looked at the launcher :-).

sudo -u [other_user] -H /usr/bin/firefox-3.5 -a [profile] -P [profile]

The -H is necessary because if it's not given then it'll use your own home directory rather than the home directory of other_user.

Wednesday, September 09, 2009

Ubuntu 9.04 gphoto2/libgphoto2 borken for my Canon Digital Ixus 700

I use gthumb for downloading camera pictures to my computer. I have a script that takes the filenames produced by gthumb and renames and creates resized copies of the images and videos. gphoto2 talks to the camera in PTP mode.

For a while gthumb worked on my laptops. It's stopped working now though and I don't know why. There are bugs posted with Ubuntu regarding this. Adding yet another bug confirmation won't do any good.

At one point I had gphotofs working enough to mount the camera filesystem. But I didn't want to mess with the filesystem directly. And anyway, gphotofs isn't working anymore now (it runs, returns, but doesn't actually mount the filesystem, and gphotofs keeps running in the background [which is OK, that's what it needs to do as a fuse filesystem provider]).

So now I have a horrendous hack for grabbing the images :-). I installed Ubuntu Intrepid under VirtualBox, gave it access to the USB devices, and I run gthumb there. Then I just scp the files over to the host box and halt Intrepid.

Yech. It works, but is hoogly :-). Maybe this'll be fixed in Karmic.

Overall, I find Ubuntu a pretty good platform for doing everything I need to do, but there certainly are the little niggles like this that demonstrate it's not really ready for regular users. Or it is, but they'll come up against walls every once in a while, get frustrated, and go back to their windows viruses.

[Update]
Ah, pulled in gphoto2, libgphoto2 and libgphoto2-port0 from karmic (downloaded the debs manually and installed with dpkg -i) and gthumb is now downloading the pictures. I understand about lack of resources, but it does seem a bug that this fix wasn't backported to work with Jaunty.

[Update]
I'm now actually on Karmic. The dist-upgrade reverted a separate and necessary fix. Gnome has a gvfs module for gphoto2 and when it's loaded, gthumb can't read the pictures/videos from the camera since the PTP port is already in use (by the gvfs gphoto2 module). Solution is to disable that. There might be a neater way, but I just did
chmod a-rwx /usr/lib/gvfs/gvfsd-gphoto2.

Sunday, August 30, 2009

Screen and scrollbars!

I work with Nigel McNie and was whining (on the company IRC server) to a friend about screen and how I wish I could get it to work with scrollbars. He pointed me at Nigel's page on how he uses screen.

I don't use urxvt, but the invocation given there works with rxvt too (just change urxvt to rxvt in the .Xdefaults entry). So now I've got scrollbars working with screen.

Slightly more secure

On my home computer I've got a reasonably secure browsing setup (firefox 3.5, noscript, adblock, flashblock, made the flash cookies directory non-writeable, etc). But nothing is perfect. So I decided to raise the bar a bit. I moved my main browsing profile to a separate user account (so that even if it gets cracked, it won't have access to my ssh keys (ssh-agent is convenient, but it could be a hole), data in my home directory (svn working copies, git working copies, random other files) or to my other privileges (sudo access on this and other computers).

My trusted profiles (online banking, power company, mobile phone company, phone/internet company, cable tv company, etc) will probably go into yet another account. I haven't done that yet. But I'll get it done tomorrow, probably.

For reference:

to allow the other user to run firefox on the main display:
xhost local:[other_user_name]

and to actually run firefox as the other user:
sudo -H -u [other_user_name] firefox-3.5 -a [profile] -P [profile]

I don't think the -a should be needed there, but it doesn't work right (loading the default profile instead of the profile I want) when it's removed. So I keep it in.

Update - I wondered why youtube and other videos had no sound in this new setup. Today I realized that it's because the browser is running as the other user, and that other user isn't in the audio group.

Fixed with vigr.