Tuesday, July 05, 2005

Installing firefox extensions/themes from files

Very often we have a .jar file for a firefox theme or extension and we don't know how to install it.
The proceure indeed is very simple. All we need to do is to have a look at
http://www.mozilla.org/projects/firefox/extensions/web-api.html

Although this refers to urls we can indeed specify a jar file using parameters of the form href="file:///absolute_file_path_here" and modifying the iconURL accordingly. Have a look at
www.cse.iitd.ernet.in/~avinash/install.html

I have also seen a firefox extension for the same purpose....but I don't have the link.

Wednesday, March 02, 2005

FedoraCore 3:glibc-error

The new glibc version included in fedora core 3 does stringent memory checks.
Thats why with many applications, any failure in sanity checking results in the program getting killed, but this isn't the only bahavious that is possible. We can set the MALLOC_CHECK_ variable to get different behavious as and when they are encontered. I use MALLOC_CHECK_=1, which prints the error to stderr but doesn't kill the program.

See the Fedora Core release notes for further details.
http://fedora.redhat.com/docs/release-notes/fc3/x86/

Monday, February 28, 2005

Adding fonts : xset

Adding new fonts to your X environment is often problematic.
Following points need to be remembered when adding new fonts in the user path:
- Fonts need be in gzip format so compress them if they aren't.
- Run mkfontdir to generate the fonts.dir file in the new font directory.
- xset +fp sets up the directory in the font search path.
fp rehash rereads the font database given by the current font path.

With these steps we are ready to use the fonts. We can see out current X settings using 'xset q' commnad

Sunday, February 27, 2005

Merge Pdfs

When we need to merge different pdfs or ps files into one, 'gs' interpreter is the best. Merging files is easy just list the files to be concatenated on the command line and the merged file shall be created at the locations provided.

Example:
gs - dNOPAUSE -sDEVICE=pdfwriter -sOUTPUTFILE=Merged.pdf -dBATCH 1.pdf 2.pdf .......(in order we want them to be merged).....

Saturday, February 26, 2005

Htaccess :Restict http access to pages

Htaccess is a method that helps you share your http pages in a rescticted manner, allowing access only after authentication. For example to restrict access some directory in ~/public_html/example_dir create a ".htaccess" file in that directory with lines similar to those given below
--------
AuthType Basic
AuthName RelmName
AuthUserFile path_to_htpasswd_file_here_say_ /extra/.htpasswd
Require user list_of_usr_names_here
------------

This file says that we consult /extra/.htpasswd file to get the usr passwd pair for authentication, where the only user allowed to access are the ones listed in Require field.

The .htpasswd file need be accessible to your http-user ( apache/nobody ) for reading . Good not to have it readable by others.htpasswd utility can be used to set passwds for users ( these need not exist on the system)
Have a look at this link http://httpd.apache.org/docs/howto/auth.html#intro

Multiple slides per page

Often we want to save paper by printing multiple slides of a presentation per page....atleast I want to do it most of the times, saving paper :D. Best way to do this in linux is to use 'psnup' that works with ps files.

Sample usage:
pdf2ps infile.pdf outfile.ps
psnup -l -d -pletter -4up outfile.ps > final.ps

This will make it 4 slides per page, options other than '-4up have to with
'info psnup' shows the huge number of options that psnup takes.

Friday, February 25, 2005

SHLVL

At times we interested in the level of nesting of the shell we are running from ,$SHLVL stores this value .

If we compare its value at a machine's console to that obtained after you ssh to another machine, we can infact get an indirect indication of (non)interactive shells in the initialization scripts...

Friday, October 08, 2004

SSH issues

sftp and scp don't work if the shell isn't "clean", i.e the initialization files spit out characters on the stdout.
To handle this we need to ensure that in the case of non-interactive invocation of shell no output is produced .

To do this following check may suffice
if [ "SSH_TTY" = "" -a "PS1" !="" ]; then
fortune........
fi
This ensures that stdout is cluttered only when we have no tty attached to the shell and its not a non-interactive login.

A more reliable way to check non-interactive nature of shell is to look at the value of $-.
This variable contains 'i' for interactive logins.