Moving to own domain
Posted by Dimitar Panayotov on 5 April 2007, 2:06
Hello to all,
I have finally bought my own domain and I set up blog there (and copied posts from here).
Here it is:
Posted in Uncategorized | No Comments »
Posted by Dimitar Panayotov on 5 April 2007, 2:06
Hello to all,
I have finally bought my own domain and I set up blog there (and copied posts from here).
Here it is:
Posted in Uncategorized | No Comments »
Posted by Dimitar Panayotov on 11 December 2006, 10:44
Hello,
I recently discovered how to make Emacs move mouse cursor from your typing point so that it will not make your text obscure. I tried it and it works. Imagine how you use the mouse to position the point (it is quicker sometimes) and then you start to type, and the mouse just stands on your typing point way.
Not so much important, but it is a good “extra”.
Here is how you could do it:
customize-variable RET mouse-avoidance-mode
Then you can choose from several options. I personally like the jump one — it just moves mouse cursor in a random direction, but not far from the point. The other options are banish, exile, animate, proteus.
The other way is possible, too: put the custom value in your “.emacs” file. I prefer it:
(setq-default mouse-avoidance-mode jump)
The explanations are here (I guess they can be found on many, many other places, too):
http://www.gnu.org/software/emacs/manual/html_node/Mouse-Avoidance.html
Do not make war; why should you? Kill all your enemies and be a dictator!
Posted in emacs, gnu | No Comments »
Posted by Dimitar Panayotov on 30 November 2006, 2:48
Since I switched to KDE 3.5.5 (on Debian 4.0, othewise known as “Etch”), I have been trying to use DejaVu Sans Mono font in Emacs — it is a TTF font, it is beautiful, and supports many more encodings than everyday monospace fonts around.
Just for your information, If you want to install those fonts on Debian, do this:
# login as root before executing this command.
apt-get install ttf-dejavu
If you downloaded your fonts other way, you should install them in subdirectory into /usr/share/fonts/truetype (at least in KDE 3.5.5), like this:
/usr/share/fonts/truetype/ttf-dejavu
/usr/share/fonts/truetype/your-fonts
So, for the example how to make Emacs to use TTF font which you cannot see in set-default-font possible choices, I will use ttf-dejavu font name.
# login as root before executing those commands.
cd /usr/share/fonts/truetype/ttf-dejavu
mkfontscale
mkfontdir
fc-cache -fv
Now you should edit your Xorg configuration file (/etc/X11/xorg.conf) like this:
Section "Files" ... FontPath "/usr/share/fonts/truetype/ttf-dejavu" ... EndSection
Section "Module" ... Load "freetype" ... EndSection
Now restart the X server (in this case Xorg). I do it this way:
# go to the text console — for example with CTRL+ALT+F1
# login as root
/etc/init.d/kdm stop
/etc/init.d/kdm start
Now you should look as to how will your desired font name look like. Open the file "/usr/share/fonts/truetype/ttf-dejavu/fonts.dir“. It should look like that:
425 # some count
DejaVuSans-Bold.ttf -misc-dejavu sans-bold-r-normal--0-0-0-0-p-0-adobe-standard
DejaVuSans-Bold.ttf -misc-dejavu sans-bold-r-normal–0-0-0-0-p-0-adobe-symbol
DejaVuSans-Bold.ttf -misc-dejavu sans-bold-r-normal–0-0-0-0-p-0-ascii-0
DejaVuSans-Bold.ttf -misc-dejavu sans-bold-r-normal–0-0-0-0-p-0-iso10646-1
DejaVuSans-Bold.ttf -misc-dejavu sans-bold-r-normal–0-0-0-0-p-0-iso8859-10
DejaVuSans-Bold.ttf -misc-dejavu sans-bold-r-normal–0-0-0-0-p-0-iso8859-13
DejaVuSans-Bold.ttf -misc-dejavu sans-bold-r-normal–0-0-0-0-p-0-iso8859-15
…
Pick one from there, for example I picked this:
-misc-dejavu sans mono-medium-r-normal–0-0-0-0-m-0-iso10646-1
There are two ways to proceed ahead: “dialogous” and “copy-paste in your .emacs file”.
Dialogous way:
In Emacs do this:
M-x set-default-font RET
[copy and paste your selected font PostScript name here] RET
(Clarification: press ALT+X, then type “set-default-font”, then press Enter/Return key. Then paste the PostScript name of the font, copied earlier, then press Enter/Return key. Same rules apply for all Emacs instructions.)
If you choose this way (the dialogous), you are in trouble — now the font is too big. But fear not, do this:
M-x customize-face RET
default RET
Go to “height” field. Now change the value and press “Set for Current Session” after every change; do it as many times as necessary to pick up a good font size for your taste. Afterward, if you press “Save for Future Sessions”, changes in font face and font size will be written to your .emacs file and thus kept for future use.
Copy-paste in your .emacs file:
Copy and paste this (or your font PostScript name choice):
(custom-set-faces
‘(default ((t (:stipple nil :background “#ffffff” :foreground “#000000″ :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 80 :width normal :family “misc-dejavu sans mono”)))))
Of course, the second approach requires either restarting of Emacs or Lisp-evaluating the line in place (with C-x C-e).
And that’s it. I have still not figured out a way to make Emacs show the names of all TTF fonts in set-default-font command’s possible choices. But since the scenarios described here are working, it is not a big concern. Yes, I would like to know, since the choosing from a visible list seems more clean and right for me; it means that you have done all the things properly and thus Emacs sees your fonts. If somebody knows how to do this on Emacs 21.4a, please tell me.
EDIT (2007-Mar-06; my birthday, by the way):
On Emacs 22.0.95 (got from CVS) invoking set-default-font and pressing TAB/Space to show possible choices, the fonts in the new directory actually appear. So, it seems that Emacs is doing what it should: get the available fonts from the underlying desktop/windowing system.
Posted in debian, emacs, gnu, kde | No Comments »
Posted by Dimitar Panayotov on 29 November 2006, 2:41
Ever going crazy of default indenting of Java sources by Emacs? What about code like this?

Much better, right? Here I use two things:
c-mode-hook.The custom hook should reside in your “.emacs” file like that:
(defun my-c-mode-hook () (c-set-offset ’substatement-open 2) (setq c-basic-offset 2))
It is “plugged” to do its work when pressing TAB in Emacs, like that:
(add-hook 'c-mode-common-hook 'my-c-mode-hook)
Posted in emacs, gnu | No Comments »
Posted by Dimitar Panayotov on 29 November 2006, 2:25
Put this in your “.emacs” file:
(setq-default indent-tabs-mode nil)
If you want this setting to be per-file, use Emacs file-local variables like below. Remember: file-local Emacs variables MUST be in a comment section. It varies from language to language, you know.
-*- indent-tabs-mode: nil -*-
-*- indent-tabs-mode: t -*-
The first means “only spaces, please”, and the second — “use tabs, please”.
The alternative way of specifying Emacs local variables is (again, this should be in a comment section):
Local variables:
indent-tabs-mode: nil
End:
Posted in emacs, gnu | 2 Comments »
Posted by Dimitar Panayotov on 29 November 2006, 2:04
Many time I have been using copy-region-as-kill Emacs function (with shortcut keys, of course) on Windows XP without a problem. However, I recently switched to Debian 4.0 + KDE 3.5.5, only to discover that it does not work!
I was sure that the KDE was blocking something and I was right: it has an option in its “Privacy” settings which, when enabled, does not allow transfer of data in clipboard between applications. However, even with this option disabled (and KDE restarted) it still does not work. I quickly found the right function to be called:
clipboard-kill-ring-save
Of course, to be more convenient, you should call it with a shortcut keys combination, put this in your “.emacs” file:
(global-set-key [f10] ‘clipboard-kill-ring-save)
If you want help about how exactly you should formulate your shortcut keys combination, see this:
Key Bindings - GNU Emacs Tutorial
Yes, I know it is not an easy to read documentation, and I know that we are all sick of loooooong looooong manuals, but what could we do? Read if you want.
Posted in emacs, gnu, kde | 5 Comments »
Posted by Dimitar Panayotov on 29 November 2006, 1:31
I have noticed some time ago, that nXML mode has problems with encoding names specified in the mandatory XML prolog, namely this one:
<?xml version = ‘1.0‘ encoding = ‘utf-8‘?>
And so, when one types windows-1251 (or opens XML file whose prolog is such), nXML puts this message in the status bar:
Unsupported encoding
Even worse, it refuses to save the XML, since it persists in its intention to save the file in the proper encoding, which is good. But this “unsupported encoding” thing is not quite true. It’s just that GNU Emacs does not “know” of such name in its codepage names list. You need to explicitly tell it what exactly do you mean by windows-1251 and everything is good. Put this in your “.emacs” file:
(codepage-setup 1251)
(coding-system-put ‘cp1251 ‘mime-charset ‘windows-1251)
So, what’s this? Well, GNU Emacs knows about “cpNNNN” code pages and uses them; note that it also needs to explicitly load them, too (not very smart, I think). Why it uses such charset names, I am not sure, since IANA charset registry says that windows-1251 is the only name of this encoding and no official aliases exist.
Of course, it is possible that GNU Emacs was the first one to handle multiple charsets than the IANA agency, and in absence of official and standard names, it used its own. I do not know.
These “125x” encodings are between 1250 and 1258. You may alias them all, if your underlying OS has support for them (and your fonts, too).
Posted in emacs, gnu | 2 Comments »
Posted by Dimitar Panayotov on 24 November 2006, 10:16
Many developers use GNU Emacs, but they are often annoyed when they press C-SPC (Ctrl + Space) to start selecting a region and then when they go somewhere else in the file, they execute some command on the thing which should be the currently selected region. And also often it turns out the result is not as expected. To have some knowledge what you do wrong (or to keep yourself informed in a visual manner) you could enable “Transient Mark Mode” in GNU Emacs by clicking “Options” and then “Transient mark mode”; now, when you press C-SPC (Ctrl + Space) and you move the cursor, you will see a selection growing or shrinking as you move the cursor. Basically, if you press C-g (”Quit”) no region marking will be done until you press C-SPC again. Also, any change in the current file will discard the selection. If you want to be advanced on this, see here:
http://www.delorie.com/gnu/docs/emacs/emacs_54.html
As far as I know, this is pretty well supported option in many versions/variants of GNU Emacs.
You could also do it in the non-clickable way, if you like this (like me). Just put in your “.emacs” file (wherever it is, you should know) this:
(custom-set-variables
‘(transient-mark-mode t))
And done.
Posted in emacs, gnu | 4 Comments »
Posted by Dimitar Panayotov on 20 November 2006, 2:20
Tomcat 6 does not come with ready-made security configuration (as Oracle AS and others do). In order you to be able to view online status of the server, you should go to this file:
${CATALINA_HOME}/conf/tomcat-users.xml
And put this XML snippet in its root context:
<role rolename=”manager”/>
<user username=”USER” password=”PASSWORD” roles=”manager”/>
Of course, you should replace USER / PASSWORD with your desired login details.
Posted in apache, tomcat | No Comments »
Posted by Dimitar Panayotov on 20 November 2006, 8:05
Hello to all, I finally started blogging. I have so much experiences to share, but it is highly unlikely to share the things which get me my money though
For my CV, visit my free hosted CV.
Very soon I will start writing here, and asking for comments.
See you!
Posted in cv, intro | No Comments »