Restoring GNU Parallel Functionality in Ubuntu GNOME 13.04
31st July 2013There is a handy command line utility called GNU Parallel that allows you to run Linux commands on more than one CPU core at a time to perform parallel processing of the task at hand. Here is a form of the command that is similar to one that I often use:
ls *.* | parallel gm convert -sharpen 1x3 {} sharpened_images/{}
What it does is pipe a list of files in a folder to GraphicsMagick for sharpening and outputting to a sharpened_images directory. The {} in the command is where the filenames go in the sharpening command.
This worked fine in Ubuntu GNOME 12.10 but stopped doing so after I upgraded to the next version. A look on the web set me to running the following command:
parallel --version
That produced output that included the following line:
WARNING: YOU ARE USING --tollef. IF THINGS ARE ACTING WEIRD USE --gnu.
Rerunning the original command with the --gnu
option worked, but there was a more permanent solution than using something like this:
ls *.* | parallel --gnu gm convert -sharpen 1x3 {} sharpened_images/{}
That was editing /etc/parallel/config
with root privileges to delete the --tollef
option from there. With that completed, all was as it should again, and it makes me wonder why the change was made in the first place. Perhaps because of it, there even is a discussion about the possibility of removing the --tollef
option altogether, since it raises more questions than it answers.
A display of brand loyalty
12th July 2013Since 2007, I've used a Pentax K10D DSLR as my main camera. It has travelled with me extensively, capturing over 15,000 images and serving reliably. Though its autofocus isn't the fastest, this doesn't matter for my typical subjects: landscapes, architecture, flora and transport (stationary buses and trains, for instance). Any slight underexposure in photos can be easily fixed since I shoot in DNG format, which preserves all raw image data. The camera has performed so well that I've found it difficult to justify buying a new SLR.
Lately, I have been looking at processed photos and asking myself if time has moved along for what is not far from being a six-year-old camera. At various times, I have been looking at higher members of the Pentax while wondering if an upgrade would be a good idea. First, there was the K7 and then the K5 before the K5 II got launched. Even though its predecessor is still to be found on sale, it was the newer model that became my choice.
My move to Pentax in 2007 was a case of brand disloyalty, since I had been a Canon user from when I acquired my first SLR, an EOS 300. Even now, I still have a PowerShot G11 that finds itself slipped into a pocket on many a time. Nevertheless, I find that Canon images feel a little washed out before post-processing, and that hasn't been the case with the K10D. In fact, I have been hearing good things about Nikon cameras delivering punchy results, so one of them would be a contender were it not for how well the Pentax performed.
So, what has my new K5 II body gained me that I didn't have before? For one thing, the autofocus is a major improvement on that in the K10D. It may not stop me persevering with manual focusing for most of the time, but there are occasions the option of solid autofocus is good to have. Other advances include a 16.3 megapixel sensor with a much larger ISO range. The advances in sensor technology since when the K10D appeared may give me better quality photos, and noise is something that my eyes may have begun to detect in K10D photos even at my usual ISO of 400.
Some features will not get used, though. While I rely on Live View with my PowerShot G11 due to its poor optical viewfinder, I rarely use it on the K5 II with its bright, sharp viewfinder, especially after noticing unreliable autofocus when using it (though manual focusing should work fine). By default, the screen stays on constantly, which irritated me as an optical viewfinder user, so I consulted the manual to turn it off. Similarly, I quickly abandoned the image level display. However, I've kept the horizon autocorrection feature enabled, as it helps fix the crooked horizons that often result from handheld shooting.
The K5 II may have a 3" screen on its back, but it has done nothing to increase the size of the camera. If anything, it is smaller than the K10D, and that usefully means that I am not on the lookout for a new camera holster. Not having a bigger body also means there is little change in how the much camera feels in the hand compared with the older one.
In many ways, the K5 II works very like the K10D once I took control over settings that didn't suit me. Both have Shake Reduction in their camera bodies, though the setting has been moved into the settings menu in the new camera, when the older one had a separate switch on its body. Since I'd be inclined to leave it on all the time and prefer not to have it knocked off accidentally, this is not an issue. Otherwise, many of the various switches are in the same places, so it's not that difficult to find my way around them.
The K5 II includes other changes, like a mode dial lock, but I'm familiar with this feature from Canon EOS cameras, so it doesn't feel like a downgrade. The exposure compensation button has been relocated to the top of the camera, making it easier to find and use; I'm using it more than I did on the K10D. Since I also use this feature on my G11, I'm applying similar experimentation to the K5 II. Next to it is a new ISO button, which I plan to test to see how it performs.
My main criticism of the K5 II is its cluttered menu system. The K10D's long scrollable lists have been replaced with multiple tabs that eliminate on-screen scrolling. However, I think this fragments the interface too much and makes navigating settings more intimidating for less technical users. Essential settings remain accessible; I continue using RAW DNG files as usual, though JPEG and Pentax's proprietary RAW format are also available. After initially forgetting to set the date, I quickly fixed this. Similarly, I disabled the default setting that stores files in date-based folders, instead directing everything to a single PENTX
directory to match my workflow. Recently, I discovered the option to add photographer and copyright information to image file metadata. This seems particularly useful given proposed U.K. legislation that would weaken automatic copyright protections, even though most photographers oppose these legal changes.
A camera's true value lies in the quality of its images, and I'm pleased with what the K5 II produces. The larger file sizes mean fewer images fit on a memory card, though increased SDHC capacities help offset this, even as I avoid excessive shooting. While using the camera, I was surprised to find apertures like F/14 and F/18, as I was used to values like F/11, F/13, F/16, F/19, and F/22. Most traditional values remain available, so there's not a complete departure from convention. Similarly with shutter speeds, I noticed 1/100 and 1/160 where I expected only 1/90, 1/125, and 1/250. These additional options provide more flexibility and potentially make achieving correct exposures easier, though what constitutes "correct" should be determined by the photographer, not the camera's algorithms. So far, I've mostly used ISO 400, except for some evening woodland testing shortly after getting the camera.
While I've been meaning to share my thoughts on the K5 II since acquiring it a few months ago, I needed time to organize my ideas. Initially, I felt overwhelmed by how much there was to say, even more than what you've read here. There are still features to explore, like white balance adjustments and their effect on image quality. After discovering its shake reduction was switched off, I'm also reconsidering my K10D, especially since this might explain the quality issues I mentioned earlier. Using my tripod more consistently would be another improvement. Clearly, I have many more photographic explorations ahead.
Dealing with the Lack of Categories in the Application Overview Screen for GNOME Shell 3.8
10th July 2013Browsing through installed applications on computer systems is something that I find useful. While this is usually straightforward, some developers have replaced traditional menus with search boxes. GNOME Shell 3.8 has fallen into this trap. You can add the Applications Menu extension from GNOME Shell Classic, which I've tried, but it sometimes freezes the desktop session, so I don't recommend it.
However, there is a setting that brings back those application categories in the overview screen, and it can be set using dconf-editor
. After opening up the application, navigate to org > gnome > shell using the tree in the left-hand panel of the tool. Editing the app-folder-categories entry in the right-hand panel is what adds the categories back for you. The default is ['Utilities', 'Sundry'] and this needs to be changed to ['Utilities', 'Games', 'Sundry', 'Office', 'Network', 'Internet', 'Graphics', 'Multimedia', 'System', 'Development', 'Accessories', 'System Settings', 'Other'].
After making these changes, the application overview screen displays categories in a new layout. Application icons appear in the middle, with categories listed on the right side. Clicking a category opens a panel showing applications within that category, which can then be closed. Navigating through categories requires opening and closing different panels. While the interface behaviour has changed, the core functionality remains, and I've heard GNOME Shell 3.10 will further refine this system.
For those wanting to exit all of this and get something like the old GNOME 2, it is possible to add the Classic Session. In Fedora 19, it's a matter of issuing something like the following command:
sudo yum -y install gnome-classic-session
In reality, this is a case of adding a number of extensions and changing the panel colour from black to grey, but it works without needing the category tweak that I described above. The Application Menu extension does need more stability hardening before I'd trust it completely, though. There's no point having a nicer interface if it's going to freeze up on you too often.
Command Line Processing of EXIF Image Metadata
8th July 2013There is a bill making its way through the U.K. parliament at this time that could reduce the power of copyright when it comes to images placed on the web. The current situation is that anyone who creates an image automatically holds the copyright for it. However, the new legislation will remove that if it becomes law as it stands. As it happens, the Royal Photographic Society is doing what it can to avoid any changes to what we have now. Though there may be the barrier of due diligence, how many of us take steps to mark our own intellectual property? For one, I have been less that attentive to this and now wonder if there is anything more that I should be doing. While others may copyleft their images instead, I don't want to find myself unable to share my own photos because another party is claiming rights over them. There's watermarking as an object, yet I also want to add something to the image metadata too.
That got me wondering about adding metadata to any images that I post online that assert my status as the copyright holder. It may not be perfect, but any action is better than doing nothing at all. Given that I don't post photos where EXIF metadata is stripped as part of the uploading process, it should be there to see for anyone who bothers to check, and there may not be many who do.
Because I also wanted to batch process images, I looked for a command line tool to do the needful and found ExifTool. Being a Perl library, it is cross-platform so you can use it on Linux, Windows and even OS X. To install it on a Debian or Ubuntu-based Linux distro, just use the following command:
sudo apt-get install libimage-exiftool-perl
The form of the command that I found useful for adding the actual copyright information is below:
exiftool -p "-copyright=(c) John ..." -ext jpg -overwrite_original
The -p switch preserves the timestamp of the image file, while the -overwrite_original
one ensures that you don't end up with unwanted backup files. The copyright message goes within the quotes along with the -copyright
option. With a little shell scripting, you can traverse a directory structure and change the metadata for any image files contained in different sub-folders. If you wish to do more than this, there's always the user documentation to be consulted.
Adding Microsoft Core Fonts to Fedora 19
6th July 2013While I have a previous posting from 2009 that discusses adding Microsoft's Core Fonts to the then current version of Fedora, it did strike me that I hadn't laid out the series of commands that were used. Instead, I referred to an external and unofficial Fedora FAQ. That's still there, yet I also felt that I was leaving things a little to chance, given how websites can disappear quite suddenly.
Even after next to four years, it still amazes me that you cannot install Microsoft's Core Fonts in Fedora as you would on Ubuntu, Linux Mint or even Debian. Therefore, the following series of steps is as necessary now as it was then.
The first step is to add in a number of precursor applications such as wget
for command line file downloading from websites, cabextract
for extracting the contents of Windows CAB files, rpmbuild
for creating RPM installers and utilities for the XFS file system that chkfontpath
needs:
sudo yum -y install rpm-build cabextract ttmkfdir wget xfs
Here, I have gone with terminal commands that use sudo
, but you could become the superuser (root) for all of this and there are those who believe you should. The -y switch tells yum to go ahead with prompting you for permission before it does any installations. The next step is to download the Microsoft fonts package with wget
:
sudo wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
Once that is done, you need to install the chkfontpath
package because the RPM for the fonts cannot be built without it:
sudo rpm -ivh http://dl.atrpms.net/all/chkfontpath
Once that is in place, you are ready to create the RPM file using this command:
sudo rpmbuild -ba msttcorefonts-2.0-1.spec
After the RPM has been created, it is time to install it:
sudo yum install --nogpgcheck ~/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
When installation has completed, the process is done. Because I used sudo
, all of this happened in my own home area, so there was a need for some housekeeping afterwards. If you did it by becoming the root user, then the files would be there instead, and that's the scenario in the online FAQ.
A look at Windows 8.1
4th July 2013Last week, Microsoft released a preview of Windows 8.1 and some hailed the return of the Start button, yet the reality is not as simple as that. Being a Linux user, I am left wondering if ideas have been borrowed from GNOME Shell instead of putting back the Start Menu like it was in Windows 7. What we have got is a smoothing of the interface that is there for those who like to tweak settings and not available by default. GNOME Shell has been controversial too, so borrowing from it is not an uncontentious move, even if there are people like me who are at home with that kind of interface.
What you get now is more configuration options to go with the new Start button. While right-clicking on the latter does get you a menu, this is no Start Menu like we had before. Instead, we get a settings menu with a "Shut down" entry. That's better than before, which might be saying something about what was done in Windows 8, and it produces a sub-menu with options of shutting down or restarting your PC as well as putting it to sleep. Otherwise, it is a place for accessing system configuration items and not your more usual software, not a bad thing, but it's best to be clear about these things. Holding down the Windows key and pressing X will pop up the same menu if you prefer keyboard shortcuts, and I have a soft spot for them too.
The real power is to be discovered when you right-click on the task bar and select Properties from the pop-up menu. Within the dialogue box that appears, there is the Navigation tab that contains a whole plethora of interesting options. Corner navigation can be scaled back to remove the options of switching between applications in the upper-left corner or getting what is called the Charms menu from the upper-right corner. Things get interesting in the Start Screen section. This where you tell Windows to boot to the desktop instead of the Start Screen and adjust what the Start button gives you. For instance, you can make it use your desktop background and display the Start Screen Apps View. Both of these make the new Start interface less intrusive and make the Apps View feel not unlike the way GNOME Shell overlays your screen when you hit the Activities button or hover over the upper-left corner of the desktop.
It all seems rather more like a series of little concessions, and not the restoration that some (many?) would prefer. Classic Shell still works for all those seeking an actual Start Menu and even replaces the restored Microsoft Start button too. So, if the new improvements aren't enough for you, you still can take matters into your own hands until you start to take advantage of what's new in 8.1.
Apart from the refusal to give us back a Windows 7 style desktop experience, we now have a touchscreen keyboard button added to the taskbar. So far, it always appears there even when I try turning it off. For me, that's a bug, so it's something that I'd like to see fixed before the final release.
All in all, Windows 8.1 feels more polished than Windows 8 was and will be a free update when the production version is released. My explorations have taken place within a separate VMware virtual machine because updating a Windows 8 installation to the 8.1 preview is forcing a complete re-installation on yourself later on. Though there are talks about Windows 9 now, I am left wondering if going for point releases like 8.2, 8.3, etc. might be a better strategy for Microsoft. It still looks as if Windows 8 could do with continual polishing before it gets more acceptable to users. 8.1 is a step forward, and more like it may be needed yet.
Turning on autocompletion for the bash shell in terminal sessions
26th June 2013At some point, I managed to lose the ability to have tab-key-based autocompletion on terminal sessions on my Ubuntu GNOME machine. Wanting it caused had me to turn to the web for an answer, and I found it on a Linux Mint forum; the bash shell is so pervasive in the UNIX and Linux worlds that you can look anywhere for a fix like this.
The problem centred around the .bashrc
file in my home area. It does have quite a few handy custom aliases, and I must have done a foolish spring-clean on the file sometime. That is the only way that I can explain how the following lines got removed:
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
What they do is look to see if /etc/bash_completion can be found on your system and to use it for tab-based autocompletion. With the lines not in .bashrc
, it couldn't happen. Others may replace bash_completion with bash.bashrc
to get a fuller complement of features, but I'll stick with what I have for now.
Installing Nightingale music player on Ubuntu 13.04
25th June 2013Ever since the Songbird project concentrated its efforts to support only Windows and OS X, the Firefox-based music player has been absent from a Linux user's world. However, the project is open source and a fork called Nightingale now fulfils the same needs. Intriguingly, it too is available for Windows and OS X users, which leaves me wondering why that overlap has happened. However, Songbird also is available as a web app and as an app on both Android and iOS, while Nightingale sticks to being a desktop application.
To add it to Ubuntu, you need to set up a new repository. That can be done using the Software Centre but issuing a command in a terminal can be so much quicker and cleaner, so here it is:
sudo add-apt-repository ppa:nightingaleteam/nightingale-release
Apart from entering your password, there will be a prompt to continue by pressing the carriage return key or cancelling with CTRL + C. For our purposes, it is the first action that's needed and once that's done the needful, you can execute the following command:
sudo apt-get update && sudo apt-get install nightingale
This is in two parts: the first updates the repositories on your system, while the second actually installs the software. When that is complete, you are ready to run Nightingale and, with the repository, staying up to date is not a chore either. In fact, using the above commands brings another advantage: it is that they should work in any Ubuntu derivatives, such as Linux Mint.
A need to update graphics hardware
16th June 2013As someone who doesn't play computer games, I rarely prioritise graphics card upgrades. Yet, I recently upgraded graphics cards in two of my PCs despite nothing being broken. My backup machine, built nearly four years ago, has run multiple Linux distributions. It uses an ASRock K10N78 motherboard from MicroDirect with an integrated NVIDIA graphics chip that performs adequately, if not exceptionally. The only issue was slightly poor text rendering in web browsers, but this alone wasn't enough to justify adding a dedicated graphics card.
More recently, I ran into trouble with Sabayon 13.04 with only the 2D variant of the Cinnamon desktop environment working on it and things getting totally non-functional when a full re-installation of the GNOME edition was attempted. Everything went fine until I added the latest updates to the system, when a reboot revealed that it was impossible to boot into a desktop environment. Some will relish this as a challenge, but I need to admit that I am not one of those. In fact, I tried out two Arch-based distros on the same PC and got the same results following a system update on each. So, my explorations of Antergos and Manjaro have to continue in virtual machines instead.
When I tried Linux Mint 15 Cinnamon, it worked perfectly. However, newer distributions with systemd didn't work with my onboard NVIDIA graphics. Since systemd will likely come to Linux Mint eventually, I decided to add a dedicated graphics card. Based on good past experiences with Radeon, I chose an AMD Radeon HD 6450 from PC World, confirming it had Linux driver support. Installation was simple: power off, insert card, close case, power on. Later, I configured the BIOS to prioritise PCI Express graphics, though this step wasn't necessary. I then used Linux Mint's Additional Driver applet to install the proprietary driver and restarted. To improve web browser font rendering, I selected full RGBA hinting in the Fonts applet. The improvement was obvious, though still not as good as on my main machine. Overall, the upgrade improved performance and future-proofed my system.
After upgrading my standby machine, I examined my main PC. It has both onboard Radeon graphics and an added Radeon 4650 card. Ubuntu GNOME 12.10 and 13.04 weren't providing 3D support to VMware Player, which complained when virtual machines were configured for 3D. Installing the latest fglrx
driver only made things worse, leaving me with just a command line instead of a graphical interface. The only fix was to run one of the following commands and reboot:
sudo apt-get remove fglrx
sudo apt-get remove fglrx-updates
Looking at the AMD website revealed that they no longer support 2000, 3000 or 4000 series Radeon cards with their latest Catalyst driver, the last version that did not install on my machine since it was built for version 3.4.x of the Linux kernel. A new graphics card then was in order if I wanted 3D graphics in VMware VM's and both GNOME and Cinnamon appear to need this capability. Another ASUS card, a Radeon HD 6670, duly was acquired and installed in a manner similar to the Radeon HD 6450 on the standby PC. Apart from not needing to alter the font rendering (there is a Font tab on the Gnome Tweak Tool where this can be set), the only real exception was to add the Jockey software to my main PC for installation of the proprietary Radeon driver. The following command does this:
sudo apt-get install jockey-kde
After completing installation, I ran the jockey-kde
command and selected the first driver option. Upon restart, the system worked properly except for an AMD message in the bottom-right corner warning about unrecognised hardware. Since there were two identical entries in the Jockey list, I tried the second option. After restarting, the incompatibility message disappeared and everything functioned correctly. VMware even ran virtual machines with 3D support without any errors, confirming the upgrade had solved my problem.
Hearing of someone doing two PC graphics card upgrades during a single weekend may make you see them as an enthusiast, but my disinterest in computer gaming belies this. Maybe it highlights that Linux operating systems need 3D more than might be expected. The Cinnamon desktop environment now issues messages if it is operating in 2D mode with software 3D rendering and GNOME always had the tendency to fall back to classic mode, as it had been doing when Sabayon was installed on my standby PC. However, there remain cases where Linux can rejuvenate older hardware and I installed Lubuntu onto a machine with 10-year-old technology on there (an 1100 MHz Athlon CPU, 1GB of RAM and 60GB of hard drive space in a case dating from 1998) and it works surprisingly well too.
It appears that having fancier desktop environments like GNOME Shell and Cinnamon means having the hardware on which it could run. For a while, I have been tempted by the possibility of a new PC, since even my main machine is not far from four years old either. However, I also spied a CPU, motherboard and RAM bundle featuring an Intel Core i5-4670 CPU, 8GB of Corsair Vengeance Pro Blue memory and a Gigabyte Z87-HD3 ATX motherboard included as part of a pre-built bundle (with a heat sink and fan for the CPU) for around £420. Even for someone who has used AMD CPU's since 1998, that does look tempting, but I'll hold off before making any such upgrade decisions. Apart from exercising sensible spending restraint, waiting for Linux UEFI support to mature a little more may be no bad idea either.
Update 2013-06-23: The new graphics card in my main machine works well and has reduced system error messages; Ubuntu GNOME 13.04 likely had issues with my old card. On my standby machine, I found and removed a rogue .fonts.conf
file in my home directory, which dramatically improved font display. If you find this file on your system, consider removing or renaming it to see if it helps. Alternatively, adjusting font rendering settings can improve display quality, even on older systems like Debian 6 with GNOME 2. I may test these improvements on Debian 7.1 in the future.
Creating empty text files and changing file timestamps using Windows Command Prompt & Powershell
17th May 2013Linux and UNIX have the touch command for changing the creation dates and times for files. However, it also creates empty text files for you as well. In fact, there are times when I feel the need to do this sort of thing on Windows too and the following command accomplishes the deed when run in a Command Prompt window:
type nul > command.bat
Essentially, null output is sent to a file that is created anew, command.bat in this case. Then, you can edit it in Notepad (or whatever is your choice of text editor) and add in what you need. This will not work in PowerShell, so you need another command for that:
New-Item command.bat -type file1
This uses the New-Item command, which also can be used to create folders as well if you so desire. Then, the command becomes the following:
New-Item c:\commands -type directory1
Note that file1 in the previous example has become directory1
and there is the -force
option should you need to overwrite what already exists for some reason...
That other use of the UNIX/Linux touch command can be performed from the Command Prompt too, and here is an example command:
copy /b file.txt +,,
The /b switch switches on binary behaviour for the copy command, though that appears to be the default action anyway. The +
operator triggers concatenation and ,,
gets around not having a defined destination because you cannot copy a file over itself. If that were possible, then there would no need for special syntax for changing the date and time for a file.
For doing the same thing with PowerShell, try the following:
(GetChildItem test.txt).LastWriteTime=Get-Date
The GetChildItem
command has aliases of gci
, dir
and ls
and the last two of these give away its essential purpose. Here, it is used to pick out the test.txt file so that its timestamp can be replaced with the current date and time returned by the Get-Date command. The syntax looks a little more complex, even if it achieves the same end. Somehow, that touch command is easier to explain. Are Linux and UNIX that complicated, after all?