Custom Search
Showing posts with label Making. Show all posts
Showing posts with label Making. Show all posts

Wednesday, March 14, 2012

Random Linux Tips: Making KDE4 Behave, Thwacking Those Weirdo U3 Partitions on USB Sticks

Sometimes, we have little tips and tricks that make life easier – but don't quite take up a full article. So today I've bundled a few practices that many Linux.com readers might find helpful. You'll learn how to control window behavior in KDE4, and make Nepomuk and Strigi be useful; and remove those silly proprietary U3 partitions from USB sticks.


 


Sometimes, we have little tips and tricks that make life easier – but don't quite take up a full article. So today I've bundled a few practices that many Linux.com readers might find helpful. You'll learn how to control window behavior in KDE4, and make Nepomuk and Strigi be useful; and remove those silly proprietary U3 partitions from USB sticks.


 

Making KDE4 Behave

KDE4 comes with eleventy-eight hundred and fifteen fancy special effects, and the one that are turned on by default seem rather random. With a little digging you can figure out how to control them. The one that drives me around the bend is when dragging a window by its title bar maximizes it. This is entertaining when all you want to do is move it. How many ways do we need to maximize windows? Apparently a whole lot of them. But KDE4 has controls for everything, so you can turn this particular feature on or off in System Settings > Workspace Behavior. Go to the Screen Edges screen, and uncheck "Maximize windows by dragging them to the top of the screen." Click the Apply button and you're done.


Underneath that is "Tile windows by dragging them to the side of the screen." What I really want is a one-click tile all windows, like in Windows 3.1 and some Linux desktop environments. But this feature is fairly useful once you figure it out; when you drag a window to the top right or left edge it shrinks to one-quarter of the screen. Drag it to the bottom left or right it shrinks to half-screen size. Drag it away to restore to its previous size.


Do you get tired of swatting KDE's oversize information pop-ups out of the way? Go to the Workspace screen and un-check "Show informational tips" and then click Apply.


The fine KDE4 folks have invested a lot of energy into the semantic desktop and semantic search. You've probably heard some of the wailing against Nepomuk and Strigi because they crash or bog down the whole system. Together they index files, file metadata, comments, tags, ratings, and file contents.


Nepomuk and Strigi do bog down your system on their first run. If you can leave your computer running until they complete that initial indexing, then after that you won't even notice them. For example, on my system with a nearly full 2TB hard drive, the first run took about two days, and it used a fair whack of CPU cycles. Nepomuk and Strigi indexed over 80,000 files, and the Nepomuk database is now over 700MB. Since that first run I leave them on all the time, and they barely use 1% of memory and CPU.


You can configure Nepomuk and Strigi in System Settings > Desktop Search. On the Basic Settings tab you can turn them on and off, and the Details link tells you the Nepomuk data store statistics. Use the Desktop Query tab to choose which files and directories are indexed by Strigi. By default temporary files, core dumps, and other non-data files are not indexed. The Advanced Settings tab lets you control how much memory Nepomuk uses.


Once you've let Nepomuk and Strigi search and index your files, then what? Here is one example. Figure 1 shows the results of a search for "Dick Macinnis" (author of the Dream Studio distribution) from inside the Dolphin file manager. It found emails we had exchanged, and articles I had written that mentioned him.


You can fine-tune your search in a number of ways: Filename, Content, From Here (the current directory), Everywhere, and on the bottom right you can select Documents, Audio, Video, and other file types. Then right-click on any item found in the search to choose which application to open it, open it in a new window with the full file path displayed, and several other useful actions. So even though this semantic stuff is still a baby, it's already useful.Figure 1: A Strigi search dives deeply into your system.

Getting Rid of Weirdo U3 Partitions on USB Sticks

I have an 8GB Sandisk Cruzer that comes with a special partition loaded with the U3 Launchpad, which is a portable environment for running applications from the USB stick on Windows. There is an actual U3 specification, and compliant applications can write to the Windows registry and load files on a Windows PC. Then when the device is removed the files and registry entries are also removed, and any application settings are stored on the USB stick. This all sounds cool, except it has a hidden partition that you cannot remove by ordinary means and can't use for data storage, and it won't let you create a nice bootable Linux USB stick.


The hidden partition presents itself as a USB hub with a CD drive attached. When you plug one of these into a Linux PC it looks like a normal partitioned block device to fdisk and Gparted, but in Figure 2 we see how it looks to the KDE4 Device Notifier: it sees the U3 partition as an optical device, and can mount it and read the files.


On my system it is mounted as /media/U3 System/. The ls command, like so many old Unix-y utilities, doesn't like spaces in filenames. But not to worry, because we can still list the files with the help of some quotation marks:

$ ls "/media/U3 System/"autorun.inf LaunchPad.zip LaunchU3.exe

You can't delete these files the usual way. One way is to search your vendor's site for a delete utility, which most likely will run only on Windows. We hardy Linux users have our own special tool, and that is u3-tool. If it's not in your distro repo fetch it from Sourceforge. Run it with no options to see an option summary:

$ u3-tool Not enough argumentsu3-tool 0.3 - U3 USB stick managerUsage: u3-tool [options] Options: -c Change password -d Disable device security -D Dump all raw info(for debug) -e Enable device security -h Print this help message -i Display device info -l Load CD image into device -p Repartition device -R Reset device security, destroying private data -u Unlock device -v Use verbose output -V Print version informationFor the device name use: '/dev/sda0', '/dev/sg3'

Try running sudo u3-tool -i /dev/sdc, using your own device name of course, to see the device's partitions:


 

$ sudo u3-tool -i /dev/sdcTotal device size: 7.51 GB (8065646592 bytes)CD size: 7.69 MB (8060928 bytes)Data partition size: 7.50 GB (8057520128 bytes)

 


Use the -D option to dump complete device information. This reveals a number of interesting things, such as "Max. pass. try: 5". If it is password-protected that means you get five attempts to enter the correct password. If you fail then the device locks and the only way to get back in is to reset the password, which deletes all the data. You'll also see the serial number, manufacturer, and exact partition sizes.Figure 2: KDE4's Device Notifier sees the special U3 partition.


Sometimes, though not always, you can read these devices on Linux even when they are password-protected. They'll mount like a normal USB stick with no password. Sometimes Linux won't even be able to create the block device and you'll see a ton of these messages in dmesg:


 

[ 5773.262417] sd 8:0:0:0: [sdc] No Caching mode page present[ 5773.262422] sd 8:0:0:0: [sdc] Assuming drive cache: write through

 


If that's the case all you can do is open it on a Windows machine and reset the password. This wipes all the data, but at least you can still use the device.


Now we come to the fun part: eliminating the U3 partition entirely. Stuff it into your Linux box and run this command, using your own device name:


 

$ sudo u3-tool -p 0 /dev/sdcWARNING: Loading a new cd image causes the whole device to be whiped. This INCLUDES the data partition.I repeat: ANY EXCISTING DATA WILL BE LOST!Are you sure you want to continue? [yn] y

 


And you now have a nice normal universal USB stick without any tricksy Windows-only guff. Enjoy!


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.

Sunday, March 11, 2012

Making Short Work of Image Conversions with Converseen

Thanks to my photography background, I tend to equate "image manipulation" with "photo adjustment and retouching" – but of course that is just one task. For a lot of jobs, image manipulation means dull work like repeatedly converting, resizing, and compressing images for output – fitting them to the proper size for a post on the Web site, converting to the right format for print, and many other similar, repetitive tasks. You can use tools like GIMP and Krita for this class of work, but you would usually be better off firing up a dedicated batch conversion tool – saving yourself considerable time and mental energy. A comparatively young tool called Converseen is a good place to start.

 

Thanks to my photography background, I tend to equate "image manipulation" with "photo adjustment and retouching" – but of course that is just one task. For a lot of jobs, image manipulation means dull work like repeatedly converting, resizing, and compressing images for output – fitting them to the proper size for a post on the Web site, converting to the right format for print, and many other similar, repetitive tasks. You can use tools like GIMP and Krita for this class of work, but you would usually be better off firing up a dedicated batch conversion tool – saving yourself considerable time and mental energy. A comparatively young tool called Converseen is a good place to start.

 

Getting Started with Converseen

Converseen is a Qt-based GUI front-end to a collection of ImageMagick conversion tools. ImageMagick is itself a suite of multiple command-line image manipulation utilities with different aims, and Converseen does not implement all of them. Instead, it focuses on image resizing and format conversion, and builds a queue-like graphical interface around it. In practice, you load a series of files into the Converseen queue, adjust the output settings for each one, then punch the "Convert" button.

The project makes binaries available packaged for Ubuntu, Fedora, and openSUSE, as well as Windows and source code archives. The latest release is 0.4.9, from January 2012.

Converseen delivers time savings in two ways. First, ImageMagick itself is ridiculously fast, so Converseen gains speed right off the bat. There is no comparison between Converseen's ImageMagick-driven setup – where you configure the output settings first, then apply them en masse – and the time required to open each individual picture in a raster graphics editing application.

But second, using Converseen is also faster than using ImageMagick itself at the command line. The list-based interface allows you to tab through the list of images, and it allows you to select multiple files at once (even an entire folder-ful) then apply the same set of settings to the whole batch. The more images you need to process, the better that option becomes. You can set the desired size constraints and compression level once, and add literally as many files to the queue as you want.

Yes, it also helps that ImageMagick can convert between more than 100 file types – including potentially tricky offerings like PDF and PostScript that may not be supported in your raster editor of choice. I have found that to be a handy option when exchanging PDF documents with users on other OSes, who for one reason or another don't seem to like Evince's version of saved form data.

Using the application is straightforward; you select files to add to the queue on the right-hand side of the window pane. When you highlight any image in the queue, you can change its output settings: the output format is selectable in the drop-down box beneath the queue, and the other options are located in the preview pane on the left. This release lets you change the dimensions, output resolution, and format only. However, you can also provide renaming options, including a per-image output directory and a regular-expression-based rename.

The Competition

On the other hand, I have always found Phatch's interface a tiny bit confusing. With Phatch, you first construct a conversion "pipeline" by stacking together operations for each picture. That is certainly important if you want to take advantage of the app's extensive transformation tools, such as distorting an image, adding a reflection beneath it, and rendering it on top of a black background. But it is overkill for repetitive conversion and resizing tasks, which are where some automation is most appreciated.

In practice, I find Converseen to be the best option for generating screen-friendly sizes of images I need to upload to a Web service like Flickr, publish in a news story, or otherwise move around for output. You get better results if you edit your photos in full resolution, then export to a high-quality archival format like TIFF – but that isn't the format you would want to use in a slide show or a presentation. Although a lot of image editors allow you to choose your output format or queue up two export versions of each picture, it is a timely endeavor. Far easier is turning Converseen on the folder once, and being done with it.

I'm hopeful that future releases will expand on Converseen's functionality. As I mentioned earlier, ImageMagick offers a wide assortment of manipulation options, but I have never successfully memorized them. Consequently, every time I have to use ImageMagick to composite or stitch two files together, I end up spending several minutes either paging through the man entries or searching the lengthy ImageMagick online documentation. And that is exactly the kind of job that cries out for a little automation.

]]>
This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.