Friday, December 28, 2012

Convert .ogg to .mp3

Short recipe I found, but can't find the source for. Half my sound files are in .ogg form, and sometimes I need that to be .mp3. This is the extended version, useful for converting many files at once.
for x in *.ogg; do avconv -i "$x" -acodec libmp3lame "`basename "$x" .ogg`.mp3"; done
Note that on Linux Mint, I needed to install lame as well as some of the *extra* audio libraries from ubuntu-restricted-extras (and resolve conflicts with already installed libraries) for this to work.

Saturday, December 1, 2012

Acer C7 Chromebook - Best Deal on the Internet?

Back in July I bought myself an Acer AO756. It's an awesome Netbook-class machine, and for $350 it was a steal compared to Ultrabook prices at the time. And would still be a relative steal today.

I just picked up an Acer C7 Chromebook for my wife for Christmas for $199. She doesn't know I have this blog, so this is cool. Anyway, the Acer C7 Chromebook is essentially the same as my Acer AO756, but with only 2GB RAM, and a slightly slower Celeron. I think that Acer has cleaned up a couple of details on the finish of the machine as well. I like the finish.

This is a 3 lb. machine with an 11.6" screen. Very portable.

The keyboard is roomy and comfortable. The solid built-in mousepad gestures mean you don't need a mouse most of the time. Two-finger scroll is amazingly good.

This machine is a little thicker than an Ultrabook, and Acer takes advantage of this to offer such niceties as a real VGA port and a real ethernet port. No adapters needed.

Although I am planning on leaving Chrome OS on the machine (it is perfect for my wife), it occurs to me that the Acer C7 Chromebook might just be the best deal going on a Linux-compatible laptop/netbook. And unlike the Samsung ARM-based Chromebooks, this one should just work. It's built around Celeron and Intel-integrated graphic acceleration, both well supported by various Linux distributions. And it is spec'd out well enough to run Linux well, not like the old Atom-based Netbooks.

Google must be selling this machine for a loss. But I have to say, as a consumer, I am loving this $199 price-point standard they are pushing. These are definitely priced for the masses.


As a follow up, with not quite the same rosy opinion, here is a more thorough breakdown from arstechnica. For what it is worth, I don't think the screen wash out is that bad, and the display is otherwise beautiful.

And I don't know if it applies to this machine, but here is a link to info on ChrUbuntu. The Acer C7 is not an ARM architecture, so it should be able to run standard Ubuntu, no special instructions, from a stick. But I haven't tried it.


I generally like ChromeOS. I like it right up to the point it doesn't do something stupidly simple, like playing MP3's from the Google Drive without having to "install" a 3rd party app. And having to find that app in a rather poorly organized sea of eye candy that looks like Windows Metro. Can we just bring back some reasonable white space and grid layouts, please? I don't like UIs that are designed to confuse my brain.

The paradigm used in the Ubuntu Software Center works a lot better when you have hundreds or thousands of applications. That's a hint, if anyone from Google happens to read this blog entry.


Historical Footnote: The ChromeBook was the best selling laptop during the 2012 Christmas season. While I don't think ChromeOS will necessarily displace heavyweight operating systems like Windows and OS-X in the near term, if it takes even a small percentage of the total market it could eat into the profit margins of the big boys. Interesting times.

Tuesday, August 14, 2012

Why is My Stupid Hard-Drive Full?

This is one of those simple things you didn't know about but that you can't live without. Linux and Mac both support du, which tells you your disk usage. If you want to see your usage in a particular folder, use this form:

~ $ du -hs *

Maybe it's time to finally clean out that ~/Videos folder. Works great for cleaning out servers too.

Rumors of Linux Desktop Death Exaggerated

In the 2010 blog post Is the Linux desktop dream dead?, Steven Vaughan-Nichols asks if a Linux desktop will ever go mainstream. In the same year, PCWorld pronounced The Dream is Dead. In a follow on article, The Linux desktop is dead; Long live the Linux desktop, written in 2011, Steven pulls a Sybil. This year, PCWorld seems to have done a 180 with If Desktop Linux Is Dead, Someone Had Better Tell All Those Users.

It's not really about the desktop, is it?

I used Unity for a while, and it's actually not bad. I wanted more control over certain aspects of the user experience, though, and so I switched to Xubuntu (XFCE desktop). Recently, I bought a netbook and installed Linux Mint 13 XFCE, and was very impressed. Mint is beautiful, and "just works" out of the box, and Canonical should hire those guys as artistic consultants for Unity. But I digress.

My wife and kids, none of whom are geeks, routinely bounce around between computers in my house. They use Unity, Xubuntu, and Linux Mint 13 XFCE desktops, and occasionally Windows, interchangably. There is nothing hard about using Linux from the desktop, and it's not hard to get your bearings even when switching from Windows.

Any of these desktops is easily the equal of (some might use the term "superior to") the old XP desktop, which - let's be honest here - is still what the majority of Windows users see every day. And by the way, for most users, XP is good enough, and it just works, and you don't have to pay $250 for a new version of Office which you never use anyway. The various desktops that are available for Linux are really quite good.

And it isn't like using Linux is any harder than using Windows. I would contend that once you know what you are doing, getting things done is easier, but that's an opinion. In poorer countries, where there really isn't a choice to use Windows, people seem to have adapted to Linux easily. There are several distributions designed for children, after all. Yeah, it's popular with programmers, but it's also popular with people who buy status cell-phones and have no idea they are running Linux.

So what is holding adoption of Linux back in first-world countries?

Recently, when I was shopping for a laptop, I had a really hard time finding a name-brand laptop that did not have Windows pre-installed. Try it if you don't believe me. Even Dell, who has announced they will eventually ship laptops with either Ubuntu or Red Hat Linux pre-installed, won't sell you one now, and won't sell you one without Windows pre-installed. If you buy a Dell laptop right now, you will accept and pay for a Windows license.

Full disclosure: I ended up buying an Acer netbook. I purchased Windows as part of the deal.

I understand that this is reality. I just don't understand why it is considered legal.

Maybe it's time to stop arguing over which distribution is best, or which desktop environment is Linus's favorite, or whether the Linux desktop is dead, and change the argument.

Windows does not run programs faster than Linux - it's usually the other way around. Windows is not easier to use than Linux, and Linux doesn't have many of the quirks in Windows (disk defragment - what's that?). With Linux, you have several very good desktops to choose from. Take your pick. Unless you are tied to Office or Exchange, Windows is not more capable than Linux. Most of the software you use day to day is available for free on Linux, and software repositories are well stocked and well organized. Linux has a great community of people who help beginners, and companies like Red Hat and Canonical offer professional paid support, cheap.

We all know that Linux runs on most laptops and desktops, even if the manufacturer does not officially support it. At this time, all the major manufacturers only support Windows - across the board.

The real question is, I think, why does Microsoft still have this near-monopoly on everything that is not controlled by Apple, and what can be done about it?

By the way ... Linux Mint 13 XFCE is amazing both in looks and performance on this 11.6", 1366x768 Acer netbook. Yeah, I am one of those guys who still doesn't know that the netbook is dead. Don't harsh my mellow, dude. Anyway, I may have been forced to pay for Windows to get the hardware, but that doesn't mean I have to use it.


One thing that holds Mint back is the lack of an upgrade path. When it comes time to upgrade, you essentially have to backup, install the new version from scratch, and restore. This pain is multiplied by the number of installations you have (Linux users tend to have more than one). Not cool.

Saturday, August 11, 2012

Rocking Bash with ... PHP?!?

Here's another solution to the common scripting problem of adapting ls output for use by other commands ... solved with a (very) little PHP!

So I'm using tar to create a simple backup for a web site. Only now the website has podcasts, and I don't need to back those up. I've got a copy elsewhere, and they dwarf the size of the original site.

tar lets me specify a whole set of files and folders, so that's not the problem. I just want an automated way to specify "everything, but not this and not that." I can use ls to get a list of files, but how do I remove just a few programmatically, and how do I get ls to return the full path?

To get the list of all files in my public_html folder, one per line:

ls -a1 $HOME/public_html

To get the path to my public_html folder:

ls -d $HOME/public_html

Now, if I pipe the file names to a PHP script, and pass in the parent folder as an argument, I can use PHP to generate the full path and also selectively cull out items I don't want (including '.' and '..', which ls includes unconditionally). The -R flag runs the PHP script once for each line in the input. Very convenient.

ls -a1 $HOME/public_html | \
  php -R \
    'if(!in_array($argn, array(".","..","podcasts"))) echo $argv[1]."/".$argn."\n";' \
    $(ls -d $HOME/public_html)
$argv[] contains the command-line arguments. $argn is the line from stdin.

The completed command looks like this. It seems like there ought to be a simpler way, but this works, and I will still be able to read this next time I need to modify the script. Neat.

tar -czf $HOME/backups/web-$(date +%Y-%m-%d).tar.gz \
  $(ls -a1 $HOME/public_html | \
    php -R \
      'if(!in_array($argn, array(".","..","podcasts"))) echo $argv[1]."/".$argn."\n";' \
      $(ls -d $HOME/public_html))

Friday, August 3, 2012

Re-enable Screen Brightness Controls on Acer Aspire One (Ubuntu)

There appears to be a problem with some computers and Ubuntu-based distributions (verified on Linux Mint 13 and Lubuntu 12.10) where you can't adjust the screen brightness. This only applies if the brightness controls pop up and appear to work, but the brightness does not actually change - it's stuck at full-bright. If you aren't seeing the brightness popup, that's a different problem.

Here is how I re-enabled brightness controls on my Acer Aspire One.

gksudo gedit /etc/default/grub

Find this line:

GRUB_CMDLINE_LINUX=""

Change it to this:

GRUB_CMDLINE_LINUX="acpi_backlight=vendor"

Save changes and update Grub:

sudo update-grub

Reboot.

After doing this, I can fade all the way to black. Great for battery life! Hard to read though.

Thursday, August 2, 2012

XFCE window title and borders gone; no focus, no move

Experienced this problem on Linux Mint 13 XFCE. Not to worry. This post from Linux and Friends puts it all right.
~$ xfwm4 --replace
Many thanks! If I hadn't stumbled across this tip, I don't know how I would have been able to fix this.

This has happened to me three times now.

It appears to have something to do with corruption of the session when you log out. To avoid the problem altogether, set up your desktop the way you want it, and the log out while saving session state (it's a checkbox on the logout dialog). The next time you log out, uncheck that box. If you don't save, you can't get corruption on save, right? That's the theory anyway.


After not experiencing the problem for about 4 months, I have to give a thumbs up to the uncheck the "Save Session State" solution. Theory confirmed. Or someone fixed the bug.