I was so annoyed that the simple idea with sed did not worked like I wanted, that I wrote a short full-fledged Qt-appp for it. Code follows. Just compile the main.cpp. Usage is also explained in the header of the file.
I know it’s like to break a butterfly on a wheel, but I need this functionality since I don’t want to do such a boring task like code-styling by myself ..
Update: first version had a small glitch! Found after applying it to some bigger files.
//! @brief lessWhite should remove all multiple empty lines (newline, whitespace, tabs, spaces, ...) from the given input.
//! Based on the standard POSIX channels stdin, stdout, stderr.
//! usage like: $ ./lessWhite < input.txt > output.txt
//! terminal output will look like: "removed 67 lines!"
//! @author email@example.com
//! @version 0.02 (bugfix for "output had one additional newline at the end")
//! history: 0.01: initial state
int main(int argc, char *argv)
QString output; //the combined stuff: no checks for overflow
line = stream.readLine();
bool const currentIsEmpty(line.trimmed().isEmpty());
if(currentIsEmpty && lastWasEmpty)
removedLines++; //do nothing
if(!isVeryFirstLine) //prevent the bug with the last line == double newline
isVeryFirstLine = false; //reset now
lastWasEmpty = currentIsEmpty;
cout << output; //print to stdout
cerr << "removed " << removedLines << " lines!\n"; //print to stderr
Work of 5 min (?)
Maybe even less if you know how to handle a mouse, the keyboard and a browser … 😉
First step is to exchange the firmware with Rockbox. A very good OSS mp3-player software for several different device kinds which enhances the hardware. You can even play Doom on your player!
- set the device to MSC-mode (MTP or Auto does not work)
- get the firmware for you device: Firmware thread at the Sansa-forums
- get and run the rockbox-installer
- select device and mount-point; pick the firmware-binary; select your options (bootloader and firmware yes; no games, no themes, no fonts …): “finish”, done
The second step is to enable scrobbling:
- got to your players settings (after restarting it and select “Settings > Playback Settings > last.fm log” with “enable”)
Play some tunes and afterwards connect you device to the PC and run QTScrobbler (note: Qt not QT! We are not in a hurry ;))