Showing posts with label HowTo. Show all posts
Showing posts with label HowTo. Show all posts

Tuesday, August 9, 2011

How to fix "FontConfig <cachedir>" errors...

If you are getting "FontConfig <cachedir>" errors every time you run a program or in your Xorg.0.log file similar to the following:

Fontconfig warning: no  elements found. Check configuration.
Fontconfig warning: adding /var/cache/fontconfig
Fontconfig warning: adding ~/.fontconfig

This is a simple fix...in fact it's telling you what to do in the warning text. The last two lines mention that you need to add those xml elements into your .fonts.conf file. It's erroring out because it doesn't really add them by itself but you can simply add them manually or run:

sed '
/<\/dir>$/{
N
s%\(</dir>\)\n*\(\s*<match\)%\1\n <cachedir>/var/cache/fontconfig</cachedir>\n <cachedir>~/\.fontconfig</cachedir>\n\2%
}' .fonts.conf

Wednesday, March 16, 2011

How to add Ruby syntax highlighting in emacs

I recently had to look at some exceptions from a headless server and it was outputting errors from some ruby code. I just wanted to take a quick look at the code without downloading the file to my machine or use vnc and a graphical editor but I still wanted syntax highlighting.

I decided to install emacs and add Ruby mode to the install. Luckily I found out how from reading these two posts:
Ubuntu and Windows

It comes down to this:
  • emacs 23+ already loads it by default.
  • For emacs 22+ you need to download and move to the right directory an ".el" file then change/create your ~/.emacs file to load Ruby-mode when opening Ruby files.

mkdir downloads
cd downloads/
wget http://svn.ruby-lang.org/repos/ruby/tags/v1_9_2_0/misc/ruby-mode.el
wget http://svn.ruby-lang.org/repos/ruby/tags/v1_9_2_0/misc/ruby-electric.el
wget http://perso.tls.cena.fr/~boubaker/distrib/mode-compile.el
mv *.* /usr/local/share/emacs/site-lisp/
cat >> ~/.emacs <<"END_OF_FILE"
; loads ruby mode when a .rb file is opened.
(autoload 'ruby-mode "ruby-mode" "Major mode for editing ruby scripts." t)
(setq auto-mode-alist  (cons '(".rb$" . ruby-mode) auto-mode-alist))

; adds tabify and indentation
(add-hook 'ruby-mode-hook
      (lambda()
        (add-hook 'local-write-file-hooks
                  '(lambda()
                     (save-excursion
                       (untabify (point-min) (point-max))
                       (delete-trailing-whitespace)
                       )))
        (set (make-local-variable 'indent-tabs-mode) 'nil)
        (set (make-local-variable 'tab-width) 2)
        (imenu-add-to-menubar "IMENU")
        (define-key ruby-mode-map "\C-m" 'newline-and-indent) ;Not sure if this line is 100% right!
        (require 'ruby-electric)
        (ruby-electric-mode t)
        ))

; Install mode-compile to give friendlier compiling support!
(autoload 'mode-compile "mode-compile" "Command to compile current buffer file based on the major mode" t)
 (global-set-key "\C-cc" 'mode-compile)
(autoload 'mode-compile-kill "mode-compile" "Command to kill a compilation launched by `mode-compile'" t)
 (global-set-key "\C-ck" 'mode-compile-kill)
END_OF_FILE


Note: You dont have to move the files to the emacs directory, simply move them to your ~/.emacs.d/ folder and add the following to your ~/.emacs file at the top:
(add-to-list 'load-path "~/.emacs.d/")
I also added the code to tabify/indent and one more snippet for quick compiling. If you don't want to add those features then only download the first ".el" file and remove or don't add the last two pieces to your ~/.emacs file.

Enjoy,

Marlon

Thursday, November 18, 2010

Evolution in KDE is missing some icons...

I recently installed Evolution in my Kubuntu desktop and of course it's missing some icons. The reason is that I'm using the Oxygen theme and it doesnt have all the icons needed. Since it is a Gnome app you can fix it by simply installing the Gnome theme (you might as well since a lot of applications use it) and then edit your current GTK+ selected theme (QtCurve in my case) to fallback on those icons:

sudo apt-get install gnome-icon-theme
sudo mv /usr/share/themes/QtCurve/gtk-2.0/gtkrc /usr/share/themes/QtCurve/gtk-2.0/gtkrc.orig
sudo sh -c "echo gtk-fallback-icon-theme='\"gnome\"' > /usr/share/themes/QtCurve/gtk-2.0/gtkrc"
sudo sh -c "cat /usr/share/themes/QtCurve/gtk-2.0/gtkrc.orig >> /usr/share/themes/QtCurve/gtk-2.0/gtkrc"

NOTE: If you are using a different theme for GTK+ applications just replace QtCurve with your specific theme. You can see all of them under the /usr/share/themes/ folder.

You can now start Evolution and all the missing icons from the toolbar, calendar, etc. should be fixed. You may have noticed that I have also left the original gtkrc file as a backup with the extension ".orig". Just in case. :)

Enjoy and happy linuxing,

Marlon

Wednesday, November 3, 2010

I deleted my /etc/samba/smbd.conf file, aaaahhhhh!!!

Recently I deleted the file after messing with the settings and not getting the results I wanted. I figured I could simply delete it and it would automatically recreate it from a "default" template and it would magically reappear. I know, that was dumb.
  1. You could force an uninstall with dpkg and then reinstall with apt-get:
    sudo dpkg -r --force-depends samba-common
    sudo apt-get install samba-common
    
  2. The problem is that the configuration will break since it's missing the smbd.conf file so you will have to:
    sudo cp /usr/share/samba/smb.conf /etc/samba/smb.conf
    sudo dpkg --configure -a
    
If you have been paying attention you might be asking yourself... "Well, if I have to do that doesn't that mean that smbd.conf has actually been in the /usr/share/samba/ folder the whole time?" ...and you would be correct. If you have removed that file by mistake, like I have, all you have to do is the first command in the second step and just configure it again. You might want to keep a copy of the default one handy in case you do it again.

To summarize, all you need to do to fix this issue is:
sudo cp /usr/share/samba/smb.conf /etc/samba/smb.conf
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.default
Now you have your default file back and a ".default" copy in case you mess it up again.

Enjoy and happy linuxing,

Marlon

Wednesday, October 27, 2010

Citrix client on Ubuntu 64 bit versions.

Installing the client seems to be a breeze after downloading from the Citrix website. The problem is it wont run unless you install the x86 version of OpenMotif.  It also requests libXm.so.4 instead of the installed libXm.so.3 library. Every time I have to do it I need to search how since I forget but there are so many hits that I just cant seem to find the one with all the steps. I have decided to post it here to make it easy on myself. Hopefully it will you as well.

  1. Make sure you already have the ia32-libs libraries installed since they are required by 32 bit programs running on 64 bit linux.  They probably are, but just in case...
    sudo apt-get install ia32-libs
    

  2. Download the linux x86 client of your choice from Citrix and install it (I used the tar.gz file), after you extract it to a folder run:
    sudo ./setupwfc
    

  3. Once that's done you can check if it doesn't run with the following command:
    /usr/lib/ICAClient/wfcmgr -icaroot /usr/lib/ICAClient
    
    Note:
    It should be requesting "libXm.so.4" and if it was a 64 bit application you could install OpenMotif like so:
    sudo apt-get install libmotif4
    
    ...but it wont have a 32 bit version in it and the client is a 32 bit application which wont use a 64 bit library.

  4. Create a temp folder and go to it in the console, once there run the following commands:
    wget http://archive.ubuntu.com/ubuntu/pool/multiverse/o/openmotif/libmotif4_2.3.3-5ubuntu1_i386.deb
    dpkg -x libmotif4_2.3.3-5ubuntu1_i386.deb ./libmotif/
    sudo mv ./libmotif/usr/lib/* /usr/lib32/
    sudo chown -R root: /usr/lib32/*
    rm libmotif3_2.2.3-4_i386.deb
    rm -rf ./libmotif/
    

  5. You should now be able to either click on the icon from the applications menu or you could simply run the first command in step 3.
Note:
If you are not running an Ubuntu (Kubuntu, Xubuntu, etc.) distro just make sure to replace the wget command with the right url to your distro's archive.
Enjoy and happy linuxing,

Marlon