Fight for the Internet 1!

Friday, August 19, 2016

Fix Misaligned ePub Cover

Recently I had some ePub files that had misaligned tiny cover images. I wanted to correct this. Here's a really simple fix for many cases.

I use Calibre as my eBook reader, and it has an option to "Edit book", which will take you to the digital book file editor.

Notice the panel on the left upper area, labeled File Browser. Usually the first file in this list is the Cover html page file. Also in the middle of the left column, an area labeled Images.

Automatically Recreating the Cover
If you have a copy of the book cover (which is trivially easy thanks to Google), I suggest you just delete the first titlepage.html cover file (or whatever it is called), and the related image file under the image section.

Then go to Menu: Tools --> Add cover.

Then import the cover image, and check the option to preserve the aspect ratio.

Manually Editing the Image Alignment
Double click to open it. You may see something similar to this:

<html xmlns="">
  <meta content="ABBYY FineReader 11" name="generator" />
  <link href="Court_of_all_Shamens_files/Court_of_all_Shamens.css" rel="stylesheet" type="text/css" />


  <p><img alt="9785567648623" src="../Images/9785567648623.jpg" /><br />

The problem here is the image is just dropped into the document without any helpful formatting to make it full-sized. With a few tweaks in the code, you can make it much more aesthetically pleasing.

In the <head> section, add the <style> section:

    <style type="text/css">
@page {padding: 0pt; margin:0pt}
                        body { text-align: center; padding:0pt; margin: 0pt; }

In the <body> section, just drop in this code snippet, but replace the src="" contents with the image file in your file. Example:

    <svg xmlns="" height="100%" version="1.1" viewBox="0 0 316 532" width="100%" xmlns:xlink="">
    <image height="532" width="316" xlink:href="../Images/9785567648623.jpg"></image>

This should center and enlarge your cover image properly.

Wednesday, May 11, 2016

Firefox not recognizing googletalk plugins

I'm not sure if I can make this a full tutorial but this information is still useful for people.

Basically I'm running an instance of Firefox from a downloaded tar.gz file from the Mozilla website.

For some reason it wouldn't recognize the install system libraries for the  Googletalk plugin. So simply put, I did install the downloaded RPM from Google (or the DEB file if you are using Debian). And then I copies all the library *.so files to a folder in my home folder. Specifically this folder:


Just sharing in it helps anyone.

Thursday, May 5, 2016

Calibre Author and Title Sorting

So I quite like the eBook management program called Calibre. But it has a few bad defaults. It outputs titles in a weird name format saving to disk (and sometimes author names). And it sorts authors by default with last name first (even storing them as such). This is wrong.

To fix the author sorting (and author name output when saving to disk):

1) Start calibre
1) Go to Preferences -> Advanced -> Tweaks.
2) Use the search option to find: "Author sort name algorithm"
3) There will be a few panels, including an area with text you can input or edit. In this area, find the line which starts with: author_sort_copy_method. If it doesn't exist, then skip to step 5 and just add it.
4) Here you can change the author sorting algorithm. Above this text input area is a brief description of the accepted options. But changes are you want to use the word copy.
5) Set the line: author_sort_copy_method = 'copy'
6) Click the button to "Apply changes to this tweak"
7) Restart calibre. It will probably ask you to anyway.

Now the work begins. I hope you don't have a lot of authors.

8) Back in the main view of the program, there is a column with your authors listed by name. Right-click on an author. Choose 'Manage Authors'.
9) There will be a column simply named "Authors".
10) Go through the entire list and change every author to be in order you want. (You can do it bit by bit or all at once. It doesn't matter to press OK occasionally and repeat these steps.) To make an entry editable, double click it. You press enter when you are finished editing.
11) As you change the values in the "Authors" column, the value names in the column labeled "Author sort" will change.

Correct any of the author_sort values that are wrong in your mind. Calibre will sort by the value in that box, so it must make sense to you.

12) When you are done press OK. Calibre will resort all of your changes. This might take a while.

The authors displayed in the tag view and in the library pane should all change.

13) Repeat 8-12 until all authors are changed and all author_sort values are correct.
13) Lastly, select all your books in your library.
14) Press 'e' to open the bulk metadata edit dialog.
15) Check the box 'automatically set author sort'. DO NOT check/change any other box.
16) Press OK. Wait until done.

I'm just passing these instructions along for my own notes and reference. Credit for these originally goes to Chaley:

Saturday, August 22, 2015

SSHD and Selinux

In Summary: Turn off SELinux. ALWAYS.

Sorry for the huge text, I just spent an hour in Fedora trying to get my firewall to allow SSHD to operate. No matter what I did, it would not work. Finally I disabled the firewall completely for debugging purposes, but it still wouldn't work! The error messages were no help!

Then, after raging at the machine for an hour, it dawned on me. This was a fresh install of Fedora. I hadn't disabled SELinux.

I can't believe how many times SELinux has bitten me in the ass. It never seems to work for anything good, but always hinder people. I consider myself a very advanced Linux User and I find it overly cumbersome. There needs to be a less.... ogre-like system put in place by default, like Ubuntu's Apper. That never got in my way BUT EVERY FLIPPING TIME SELinux has got in my way.

On systems with SELinux disabled, the SELINUX=disabled option is configured in /etc/selinux/config:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - No SELinux policy is loaded.

Go do this now. You will thank yourself. I've never heard of SELinux benefitting the average user. Ever. Ever ever ever. I'm sure someone in a corporate environment has had luck though, but they have someone on retainer there to babysit this monstrousity. And I pity that person.

Saturday, July 4, 2015

Gnome developers once again demonstrate the bad community approach

This may be old news to some but I was just bitten by it when upgrading to Fedora 22. Some of my favorite applications (Firefox among them) upgraded to GTK3.

Now GTK3 isn't supposed to be terrible. In fact I have come to seriously appreciate some of the keyboard accelerators in GTK2 File-saving and File-opening dialog windows.

But apparently effeciency, ease of use, understandability of design, and generally being good are something that the Gnome developers hate. Simply put:

GTK 3.10 Drops Menu Icons and Mnemonics

This is the new GTK3 default, unannounced as far as I can tell, and not publicly discussed. Thank you Gnome Developers. I wasn't aware Gnome is how you spell Microsoft.

Okay, I'm being a bit harsh but the Gnome project has a nasty habit of taking very very little public input and being a difficult community to penetrate. I've tried to join Gnome three projects in the past, bringing some patches and code features I'd made, but it was like talking to a black-hole.

This is one of the reasons I love KDE. They have a thriving vibrant community (and sure they make their mistakes but they keep fixing things, not breaking them and sipping their soy-bean lattes and pretend they are flawless).

I digress.

The Bad News Gets Worse

For now you can restore the missing menu icons. (But knowing Gnome I wouldn't hold out on that one lasting forever.) However...

No Mnemonics Either – At All
In addition, as you can see in the above shot, mnemonics have been removed entirely. These are where eg “Copy” in the menu has an underlined ‘C’, allowing you to press Alt+C to activate it. SpaceFM allows you to customize these too. Mnemonics have also been removed from dialog labels, meaning, for example, you can no longer press Alt+N in SpaceFM’s rename dialog to put the cursor in the Name box, and you can’t click an OK button by pressing Alt+O.
Unlike the missing menu icons, it appears that mnemonics have been permanently disabled. Per the GTK 3.10 docs: “gtk-enable-mnemonics has been deprecated since version 3.10 and should not be used in newly-written code. This setting is ignored.”

The Irony is Terrible

I guess it’s telling that the GIMP project, the original developer of GTK (GIMP Toolkit), is sticking to GTK2, and they’ve been told not to expect to be able to use GTK3 for such a robust app.

Monday, June 29, 2015

Firefox add on could not be installed because it appears to be corrupt

Just a quick reference for those out there that encounter this problem. Today I was having problems with Firefox failing to save any pictures to my harddrive. The moment I clicked "Save as..." the screen would blink and there would be a "Failed' item under my downloads list.

I tried Refreshing Firefox and also creating a couple of new Firefox profiles. But when I tried to Refresh or create a new profile, I encountered this error message:

"This add on could not be installed because it appears to be corrupt."

I have never seen this error before. Soon all the add-ons from Mozilla I tried to install were seemingly corrupt. More and more digging finally lead me to an unlikely problem:

On my Linux machine, the /tmpfs drive (located in /run/user/1000) had completely filled up. This has also likely been the source of problems with Ktorrent not functioning properly.

So to those who encounter this problem: Clear your tmpfs! I rebooted and it solved the problem temporarily.

Friday, May 29, 2015

Fedora Upgrade from 21 to 22 Experience

Fedora 22 is without a doubt the most broken KDE has been in literal years.

So this is a long somewhat ranting list about problems I had with Fedora 22. I don't want readers to mistake my opinion on Fedora, Linux, and KDE in general. I love Linux. It makes me happy to use it, and I have trouble imagining my Linux experience without KDE. Lastly Fedora 21 has treated me very very nicely, and I'm sticking with Fedora and KDE even through this.

The breakage is to be expected somewhat, with all their huge move to KDE5 apps. But the amount of breakage across so many apps is horrible. I wouldn't let this thing out of ALPHA testing at this point, some of these bugs are very bad for users.

I feel I should restate though that I really love KDE as a whole and I'm sure they will iron out most of their problems. (Though they SERIOUSLY need to give Gwenview some love. It's been neglected for years....)

The Good
The default color scene is better, the default window decorations are better as well. They are still a little avant-garde for my tastes, but not bad.

Only... it's horrible broken. So while it looks nice it functionally fails thoroughly. Read on.

The Not So Bad
It's been weeks, possibly months and several major bugs haven't been fixed. Also I keep finding new ones.

I think my favorite non-rage inducing bug is when I had two VLC windows open. One was open, paused mid-video and minimized. I was watching another video, and somehow, when my instant messenger beeped me (Skype, which is itself its own massive shit pile when it comes to Linux sound integration), my OTHER minimized VLC window suddenly started playing again! ... What?

The Bad
The new version of Klipper for KDE unfortunately VERY unstable. Using it for much of anything locks up the Plasma Shell and causes a runaway memory leak. Thank God I memorized the unattended reboot command for KDE. It is also missing some important features. One of them being Pasting as Plain Text. Two, being able to TURN IT OFF if you want. Three, USING AN ALTERNATIVE CLIPBOARD MANAGER. I'm sure some of these will be eventually address. Another problem with the user interface is that the preview area of the text snippets is notably smaller than the previous version.

KDE-Telepathy popped up and would not go away. I could only hide it but not quit the program. Eventually I had to find the package name and uninstall it to stop the app from autostarting.

Which is another thing, how to disable auto-loading of some services like Telepathy is not obvious.

Shutting down occasionally my laptop takes a LOOOOONG time. Almost a full minute before it actually kicks off. Update: This appears to be have been mitigated after a recent update.

Wine Systemtray icons aren't working properly, but I remember the KDE system tray got a big overhaul lately. Wonderful, and by that I mean totally not. (Not KDE's fault, but still annoying.)

Gwenview Zooming: Even after all these years, those ugly artifacts with Gwenview zoom-in / zoom-out still remain. This program needs some serious love.

The Worse
All my KDE session data was completely lost. The dozens of Gwenview windows I had open were gone. All my Konquorer windows and tabs were gone. All my Kate sessions were gone. This is really something special because I had backed up my session data to file folders as well.

Konsole lost EVERYTHING! All my konsole settings, which have worked for half a decade, failed to be imported. There was a serious bug with never removing the window frame as well. Update 1: Good news is the location for the konsole settings was moved, and all that was required was moving my config files to there. Annoying but fixable. Update 2: The window frame bug has to do with the management themes... which isn't user error because these were the default chosen themes and default packaged themes. But if you find the right combination the problem won't appear.

Window Management Bugs: There are several small bugs that keep popping up. The desktop slideshow wallpapers layer over each other as they change. Shading a window still leaves the window-border. Update 1: The window frame bug has to do with the management themes... which isn't user error because these were the default chosen themes and default packaged themes. But if you find the right combination the problem won't appear.

Good news: Turns out the problem was a bug in one of the default Application appearance themes. Under Application Style -> Window Decorations, pick something other than Plastik.

KDE Keyboard configurations were completely fucked, no matter if I exported from a working prior version and reinstalled. Nothing worked. I had to manually redo every single damn thing. Also many previously working global hotkeys were missing, but I attribute that to applications themselves (probably). Days later, the Global Keyboard shortcuts area is still fairly buggy. If you try to export all your keyboard settings (and why isn't there a Select-All options? SERIOUSLY!!?), but don't save, and try to export again, the System-Settings locks up.

The desktop wallpapers fail to clean themselves up as they slideshow through. Small annoyance but very ugly. At least it will probably be an easy fix for some developer.

Color schemes are somehow broken for Firefox and for Konqueror, pretty badly. I cannot see many icons and I wouldn't know they were present if I hadn't already known. They are basically invisible.

Firefox HTML5 Video / WebM Support: For whatever reason about half the videos on Firefox 38 on Fedora 22 will not work at all.

Shutting Down: Impossible sometimes. This seems to be a KDE5 bug, but basically there are rare cases where trying to trigger a shutdown/restart sequence through the KDE menus fails completely. (Sometimes it causes Plasma to crash and sometimes not.) The only option is to invoke the system command to shutdown. There used to be a KDE specific command you could throw from commandline to do it, back in KDE3. I've never found KDE4's version (and I've looked several times), nor heard of one.

The Terrible
Removing features, that really weren't an improvement: KDE removed some hotkeys to switch to the next desktop wallpaper. I wouldn't even call them hotkeys, but more like assisted underlined letters in mouse-menu commands. I cannot for the love of God fathom why these were removed. I should put in a feature request to get them restored.

Widgets: The Motif of new KDE in Fedora (or maybe it's new KDE and not Fedora's doing?) is TOO artsy, because many times I am not aware "hey, that widget is actually a button!" or "hey, there's an expand-folder arrow there!" because the style blends too much together. Sometimes it is completely invisible. This has happened about five times now, and it's not going to get any better without some change. This is a major major design flaw. I'm not sure if it is due to my color scheme not meshing well, but that's something that should have been accounted for, since I chose one of the built-in color schemes that are standard packaged with KDE.

Good news: You can fix this by going to system-settings -> Application Styles -> Widget styles -> Select something different than Breeze, as that is the source of the problem.

File-Saving / File-Picker Dialogues: The name field for saving filenames in QT applications seems to be trying to help, but is in fact really hindering.
For example, say you had a prior file like this name:
"kde4 shortcut keys layout all 2015-05-28 (Fedora 22 KDE 4.14.8)" and you wanted to edit the date for a new save file. You select it and start editing the numbers. QT/KDE auto-highlight everything else after your cursor, and any further keypresses will erase it. Worse, CTRL+Z does not bring it back. So it effectively destroys an important time saving feature of reusing text input. This is just awful and I swear to god if it is not a bug, someone needs to go back to school on interface design.

Randomly missing Keystrokes: The application Kate/Kwrite suddenly forgo 95% of all my keystrokes, even CTRL+V. KDE's Run command doesn't respond to the up-arrow for recalling previous entries.

The Absolute Worst of All --> GTK3 or the Gnome Developers

I hate to sound like a ranting lunatic but GTK3's default settings are, without a doubt, the biggest FUCK-YOU to its users I have ever seen. They would make Microsoft proud. And no, I'm not exaggerating here.

Long story short, Mnemonics are gone and many of the shortcut keys have been removed, so not only are they hidden some won't work. Lastly key-stroke accelatores are gone permanently. I would personally slap the developer(s) who thought removing keystroke accelators was a good idea. That is fucking horrible. Horrible. Gnome developers, are you listening to us?!!!

Actually I know they won't hear me. I've tried talking to the Gnome developers about four times in the past, and it is like talking to a rude concrete wall. They don't want help and they don't care about community input or external developer code. They are, and I hate to say this, the Microsoft of the Linux community

Gnome and the GTK3 team are clearly invested in spreading decelerators. Yes, that is the correct word, and no, any Gnome devs who read this you can't deny it. You know this is true. You have slowed down the speed of use, the elegance of design, and the order of presentation. I think I'll have to use the word decelerators from now on when describing this problem. Perhaps vile decelerators.

The End

After letting that Fedora 22 installation operate on my Laptop, with various problems building and building (and never any fixes coming down the pipe), it has finally rotted until I can no longer stand it. I don't know what caused it, but this afternoon I woke it up from suspend, and the Wireless network stopped working. I rebooted it. It never came back and the widget was blank. I connected via wired input, but still nothing. I tried several commands to bring up the network, and it all died.

It may be premature to judge, since there is the remote possibility this problem is hardware related. But I'm more willing to bet somehow it is this botched upgrade. I'll be reinstalling Fedora tonight, and it won't be version 22, I can tell you. Thus ends the absolute worst instance of Linux I've ever run in my 12 plus years in the genuinely wonderful world of Open-Source. To anyone reading, this isn't normal. In fact it is very very rare, and I can only think of one or two other times tops, where this has happened.

Ironically, my experience was made all the more aggravating because of the coincidence of Gnome GTK3's fuckery with punching their users in the face with decelerators. You can endure a lot when your web-browser is okay, but when that's screwed, you really feel it.