неделя, 28 ноември 2010 г.

How to run Dolphin as root?

Ok, I had this ridiculous problem today. I wanted to run Dolphin as root and I typed "sudo dolphin". Didn't work. I typed "su" and then "dolphin". Again to no avail. So little googling told me that I'm doing it wrongly.

"kdesu dolphin"

is the command. And it works :)
Maybe I'm just very unexperienced, but I think that last time I typed "sudo dolphin" it actually worked. Don't know why that changed.

сряда, 17 ноември 2010 г.

How to minimize Firefox memory usage

I don't know for what reason, but on my computer, Firefox tends to eat a lot of memory. And I mean A LOT. Like between 900MB and ~2GB. And I have 4GB in total, so obviously, that sucks.
So, I Googled a little and found a solution that so far works for me.
The tutorial found on this site has 2 parts, but on Linux, I think that only the second one works. So. Do:
1. In the address bar type: about:config
2. Search  browser.cache.disk.capacity in the filter.
3. Change the value so that it corresponds to your machine. The values are as follow:
"20000 is recommendable you have between 512Mb and 1GB of Ram. If you have less than 512Mb then reduce to 10000. Default is 50000, max is 51200. source"
Mine was set to 512000, but that didn't stop Mozilla from taking whatever I have. So now I set it to 20000 and so far everything works great.
Good luck!

понеделник, 15 ноември 2010 г.

Make Sony Reader PRS 600 show cyrillic

Hello all. Today, I got my new Reader. It's very, very cute and lovely and I'm very happy with it. It reads fine (even if the contrast is less than on the new PRS 650 or Kinddle - but then, they are more expensive or unavailable in Bulgaria). So PRS 600 it is.
For now, it behaves very nicely and I even made few drawings just for the fun of drawing on the screen. I also downloaded free books from http://www.epubbooks.com/ and some Bulgarian sites and putting them on the Reader is piece of cake. I also tried reading scientific pdf - the text is really somewhat small in the original size and looks weird when you zoom in, but the figures look cool and hey, that's the first time I actually enjoy reading that article! :)

The only problem I encountered so far is that I couldn't read Cyrillic fonts, which US people obviously consider unessential for their customers. However, it's quite important for me! So, after an hour and so unhappy searching the net, I found this extremely simple tutorial how to do the trick. In short - you can either use a patch for the firmware  (which however will eliminate the warranty) or you can convert your books to embed their own fonts and then, you can see the Cyrillic. I chose the second option and then I spent some quality time looking for an EASY way to embed fonts into EPUB file. Needless to say that this was my first time hearing about epub files :)

Anyway, he's the best solution I found so far:

Embedding your fonts into ePub automatically using Calibre
1. Download Calibre for your OS (Win/Lin/Mac) and install it;
2. Download the attached plugin file (originally from Paul Tomashevskyi, GPL, see MobileRead thread)
3. Install it via Calibre's Preferences> Plugins: provide the path to the downloaded plugin and click "Add" button;
4. Check that it has appeared in the list of plugins at File type plugins branch under EPUB Font embedding plugin name and it's enabled (which is a default behavior on plugin addition);
5. Now open Preferences> Conversion> Look & Feel and add the following CSS declaration into Extra CSS area:
body {
font-family: "Liberation", sans-serif;
This will tell Calibre that we want to use "Liberation" font family we're going to embed into converted ePub content and it will add the font-family into own styles when it parses your ePub contents;
7. Add your content - which lacks embedded fonts and CSS declarations OR its embedded fonts aren't capable of providing glyphs for our UTF codepoints - into Calibre's library;
8. Select (or highlight) the content in the library list;
9. Proceed with the next toolbar icon and its option: Convert E-Books> Convert individually;
10. Set input format and output format to EPUB;
11. Check Look & Feel and that Extra CSS area contains what's been specified in (5) (On Windows it was okay while under Ubuntu it took a couple of restarts for the defaults we set in (5) to pop up on actual conversions in the app: dunno, guess I did something dead wrong);
12. Click OK.
Your ebook gets converted into EPUB and we end up having a set of Calibre's own UTF aware fonts (Liberation, serif set) embedded into it. source
It looks long, but actually it's very very quick. It took me like 15 minutes with the installation of Calibre and the plugin! This cool program even has a plugin for Sony Readers! And it works awesomely in Linux and it recognized and mounted the Reader without any help from my side. I just did the steps and I had my first Cyrillic book on my Reader. The only thing that didn't get converted, who knows why, are the titles of the chapters. But the text is fine and perfectly readable.

If anyone else encounters this problem - this is the way! Also, you can use other fonts (see the source), but I didn't bother. This one works fine for me and that's the most important.

I had one more problem with some titles, who won't show properly. It turned out that they had the idiotic option "font-variant:small-caps" in their original css. Because that option is not included in the Liberation font, the font won't show those letters in Cyrillic (but in ??? instead).
Thanks to a Belorussian friend Vad, a solution is available.

One has to open the epub file manually (in Calibre, select the book and press T) and then to edit the css, by deleting all the "font-variant:small-caps" in it. Save it, close the folder, rebuild the epub and that's it.
You have titles in Cyrillic too.

събота, 13 ноември 2010 г.

Access shared folders on VirtualBox XP

Today I needed to use some shared folders on my Windows XP VirtualBox machine and it turned out that there is no obvious way to do that. I searched a little with Google and here is what remarkable HOWTO I found.

VirtualBox: access shared folders from Windows XP guest OS

What you need to do, is so very very simple.
Win+E -> open and explorer window -> click on the plus sign on My Network Places -> click on the plus sign of My Entire Network and there you go!

It's done. Really really simple, I have no idea why it doesn't work from My computer, but honestly, I don't care. Like at all. I use my VirtualBox XP for testing purposes so I don't give a damn what works and what not. The point is that now I know how to use shared folders without reading bugs or using some ridiculously complicated howtos that I won't cite here.

P.S. You need VM Virtual Box Guest Additions for this to work. To install them Devices -> Additions or Host+D

сряда, 10 ноември 2010 г.

How to make symbolic link that works!

I admit, I have some problems grasping the use of symbolic links in Linux. It just never works for me, no matter what I type. So here is the best piece of advice I found on this, ever:

How do I create a symbolic link?


For example:

ln -s /usr/local/apache/logs ./logs

This points a symbolic link "./logs" to "/usr/local/apache/logs" source

Why this is cool?
Because it creates a new file called "logs", which links directly to the directory you want to. I used it with Wine, because it didn't allow me to install a game in other directory than home, so what I did was
ln -s /media/D/dir ~/.wine/dosdevices/t:
And voila! It worked! Here t: is a letter that I didn't have before - it created this new shortcut "file" and this time, the link was fine and the game was installed on another harddrive (which was the actual point of the exercise). Weeee!

вторник, 9 ноември 2010 г.

Wine and sound

Today Rosetta Stone told me "Rosetta Stone could not find a sound output". I remembered I used to have that problem and after a little bit of searching, I discovered the solution:

In wineconfig audio tab:

1 check alsa
UNCHECK oss (and others)

2 EDIT ~/.asoundrc
comment out:
pcm.!default { type pulse }
ctl.!default { type pulse } 
  source - WineHq
This worked for me, without killing pulseaudio or anything like this.
Other suggestions for similar problem you can find here or here but I didn't try them. Now the audio is working and everything is fine.

Another Wine problem I had was the following:
"Warning: could not find DOS drive for current working directory '[My username directory]', starting in the Windows directory.
wine: cannot find '[File location]'"
Which I solved again using WineHq forum by doing:
ln -s / ~/.wine/dosdevices/z:

And it worked! 

Instead of intro

In short, this blog is not about writing, but about cool new Linux tricks I learn. I have no idea how often I will write, but I think the posts will be VERY short. It's just another scrapbook, to store useful info. Enjoy!