Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Archive for the 'Notepad' Category

    Short miscellaneous notes

    Configuring web-server: for production and for development

    25th October 2009

    Production: see http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-debian-etch – it is for Debian Etch (which is old-stable), but many of the steps apply equally well to Debian Lenny (current-stable). Also, this is a very basic guide, as if you are going to host multiple sites from multiple clients, you most definitely will need some hosting control panel.

    Development: see http://www.ruzee.com/blog/2009/01/apache-virtual-hosts-a-clean-setup-for-php-developers. This setup works very well, unless you need to create several virtual hosts every day – in which case necessary actions could be partially scripted.

    Share

    Posted in Links, Notepad, PHP, Programming, Software | No Comments »

    R under Debian testing/i386: permanently set pdfviewer option

    21st October 2009

    If you get this message when opening vignettes:

    Error in openPDF(vif) :
    getOption(‘pdfviewer’) is ”; please use ‘options(pdfviewer=…)’

    and you are tired of running this command every time:

    > options(pdfviewer=”okular”)

    then you should check if your system-wide Renviron file has proper PDF viewer set:
    Read the rest of this entry »

    Share

    Posted in *nix, how-to, Notepad, Software | No Comments »

    Convenient design and debugging of regular expressions under Linux

    10th October 2009

    redet-supported languagesRegular expressions (regexps) are powerful indeed. But debugging non-trivial regexps is a burden even if you understand how regexps work, and remember most (if not all) regexp syntax.

    Miscellaneous tools exist to ease this task. This post was inspired by redet’s comparison of regexp helper tools – it could be sufficient to read only that, if you’re going to try the mentioned tools yourself. Otherwise, read on.
    Read the rest of this entry »

    Share

    Posted in *nix, Notepad, Programming, Software | No Comments »

    Best method to recursively chmod/process files or directories

    8th June 2009

    Found here.

    Recursively set directories only to drwx-rx-rx (755):

    find . -type d -exec chmod 755 {} \;

    Recursively set files only to rwx-r-r (644):

    find . -type f -exec chmod 644 {} \;

    Recursively remove carriage returns (^M) from the end of all *.php files:

    find . -type f -name “*.php” -exec /home/user/dos2unix.sh {} \;

    In all these cases, {} is replaced with the filename/directory find has found matching your parameters; \; at the end just stops exec processing.

    Share

    Posted in *nix, how-to, Links, Notepad | No Comments »

    Drupal Views: how to display random nodes/content

    4th May 2009

    Today I had a task of displaying random node in a Views-generated sidebar block.

    This is how to do that in Drupal 7 (Views 3):

    1. edit the view which makes the block available (follow http://your.site/admin/build/views/viewname/edit)
    2. in the Sort Criteria section (under Filter), look for and add Global:Random.

    This is how to do that in Drupal 6 (Views 2):

    1. edit the view which makes the block available (follow http://your.site/admin/build/views/viewname/edit)
    2. in the Sort Criteria section, add the Random criteria.

    It can’t be simpler than that.

    Share

    Posted in Drupal, Notepad, Software | 13 Comments »

    Linux: how to remove trailing ^M (carriage return)

    30th March 2009

    Imagine you have some styles.css transferred from Win machine to Linux via FTP in binary mode instead of ASCII mode; then

    cat styles.css | tr -d "\r" > styles-nocarriage.css

    will create styles-nocarriage.css with ^M’s removed.

    Alternative syntax:

    tr -d "\r" < styles.css > styles-nocarriage.css

    Most editors have global replace features which allow to get rid of control characters using regular expressions (exact instructions are editor-specific).

    For multiple files, try this:

    for f
    do
    mv $f ${f}~ && tr -d "\r" <${f}~ >$f
    rm ${f}~
    done

    Save this shell script as a file (e.g. dos2unix.sh), then do ./dos2unix.sh . This script accepts wildcards (e.g. ./dos2unix.sh *.php), so be careful!

    Share

    Posted in *nix, how-to, Notepad | 3 Comments »

    Best online favicon.ico generator/editor

    28th January 2009

    favicon.cc has cool real-time previews and allows creating animated favicons.

    Update: check the comments below for more online favicon editors/generators!

    Share

    Posted in Links, Notepad, Software, Web | 3 Comments »