Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Which CMS is better

    3rd August 2006

    When you have a new web-project just about to be started, you frequently face the problem of the CMS selection – ‘Which CMS is better’? There’s a hundred and more various CMS out there. To name just a few – PHP-Nuke, PostNuke, Mambo, Joomla, Drupal, e107, XOOPS, Nucleus, Typo3, Xaraya, YACS! (visit http://www.opensourcecms.com/ for much more and try for yourself).

    If you gooogle this problem, you will get loads of forums discussing topics like ‘Mambo vs Drupal’, ‘PHP-Nuke vs PostNuke’ etc. But, to be sure, this ‘source’ of information is not likely to really help you choose. What you need is a good in-depth overview of the systems.
    Read the rest of this entry »

    Posted in CMS | 3 Comments »

    WordPress Related Entries

    2nd August 2006

    This is the plugin you may find useful if you want to keep visitors to your blog for more than just one-post-reading-time. This plugin will provide to the user entries, which have some common/similar words in the post/page title.

    Installation is as always easy. Most probably you will want to put these ‘related entries’ into yours ‘sidebar.php’ or ‘right-sidebar.php’ (if you have one), and your code may well look like this (I assume that in ‘Plugins’->’Related Posts Options’ you set the pre/post tags to ‘<li>’ and ‘</li>’):


    <?php if ( is_single() || is_page() ) { ?>
    <ul>
    <li><h2>Related entries</h2></li>
    <?php related_posts(); ?>
    </ul>
    <?php } ?>

    The block of PHP code above the actual insert determines whether blog visitor is on the post page or blog page – this way ‘related entries’ will not be shown in listing pages. If you want, you can leave only is_single() in place, for related entries to appear only in posts, and not in pages.

    Finally, plugin home is: http://www.w-a-s-a-b-i.com/archives/2006/02/02/wordpress-related-entries-20/

    If you want your visitors, arriving from the wrong or just outdated links to find what they might be looking for, it will be a good idea to check Related posts for your 404. That plugin adds an extra function related_posts_404(), which you should put into your ’404.php’ template file. Now, when someone gets to your 404 page, they might as well get a list of close hits from your blog, and stay longer.

    Posted in Notepad, WP PlugIns | No Comments »

    On the importance of early detecting your main interest and inclinations

    2nd August 2006

    This essay is primarily targeted at the teenagers up to 17 years old, but can also be helpful for up to 25 years (in the extreme cases). I did realize the things I am describing here quite late – only somewhere in the third year of my bachelor diploma studies. The following text is based on my own experience, and may not be appropriate for everyone.

    From my early childhood, I did not want to specialize. I just didn’t like the idea of doing only some limited portion of work, when there are so many interesting things to do. Becoming a specialist a priori seemed the way to boring life, because as a specialist you must do only the small subset of things related to you profession.

    Opposite to becoming specialized in some field, I imagined doing that and this for some short periods of time, and eventually becoming a ‘specialist in everything’ (which pretty much equals to a ‘specialist in nothing particular’).
    Read the rest of this entry »

    Posted in Life, Misc, Society | No Comments »

    How to become a millionaire: Popular Guide

    31st July 2006

    Part 1: Basic Business Hints

    I am not a millionaire myself, to start with. And yes, I do want to become one. In this essay, I am going to present you some tiny snippets I collected, which would make your own way to financial freedom easier.
    Read the rest of this entry »

    Posted in Welfare | No Comments »

    Database Backup

    22nd June 2006

    After installing WordPress, the first thing I was looking for was improving my personal WordPress experience with plugins – for extended functionality, usability, and pleasure of use :) .

    Here I will present (and regularly update) the list of plugins I looked at and installed.

    The first plugin I installed is WordPress Database Backup – we all know, how painful can the data loss be. Installation is easy (copy-activate), and on-demand database backup is immediately available in Manage -> Backup menu. Plugin automatically pre-selects all default database tables, and allows you to select any other tables you happen to have in your database – these can be, for example, tables of your WordPress plugins. I would recommend saving all the database tables, except if you know that there are tables not related to your blog (you can tell this usually by the table prefix – which is ‘wp_’ by default).

    After you are done with the selection of plugins, you can choose to download the backup, email it, or to store it on the server in a backup folder (plugin handles the creation of the backup folder for you).

    After pressing ‘Backup’, you will see a nice progress bar, and if you had chosen to download the backup, you will get gzipped backup file.

    Updates on other useful plugins coming soon… stay tuned :)

    Posted in WP PlugIns | No Comments »

    Simple substring counting script in Python

    21st June 2006

    Approximately a month ago I endeavoured to use Python as my main shell-scripting language. At that moment, I was already aware of multiple benefits you get when you use Python for scripting:

    • source-level cross-platform scripting: your script will run anywhere, where Python compiles; expanding this statement – your script will run anywhere, where there is a C compiler (needed to build Python itself)
    • high-level language: you can iterate all the lines in a text file with as little as one ‘for’-statement, for example (see the actual example below)
    • simple/minimalist syntax: no curly braces around blocks of statements, no semicolons after each and every line of code, etc. Python at a glance looks much more understandable, than, for example, Perl.
    • the power of C in a language-interpreting system
    • it is interpreted! This gives easyness of debugging: modify, execute, see the trouble – with no compile/link stages
    • and, despite being interpreted, it is fast!

    For the comparison (in speed, memory use, program size) with other computer programming languages, please see the “Computer Language Shootout Benchmarks”. Here I provide the link only to the comparison of Python with Perl and comparison of Python with PHP (which can also be used as shell-scripting language, albeit after some tinkering with settings and stuff)

    Below is an example of the 2-minute script in Python, which counts the number of occurrences of some string in a file.

    1. """Read FILE and count number of occurences of SUBSTR."""
    2. version = 0.01
    3.  
    4. import sys
    5.  
    6. def main():
    7.   from optparse import OptionParser
    8.   opts = OptionParser(usage="%prog [options] FILE SUBSTR",
    9.     version="%prog " + str(version),
    10.     description="Read FILE and count number of occurences of SUBSTR.")
    11.   opts.set_defaults(verbose=False,flush=False)
    12.   opts.add_option("-v", "--verbose", action="store_true", dest="verbose", help="Print every line containing substr [default: %default]")
    13.   opts.add_option("-f", "--flush", action="store_true", dest="flush", help="When verbose, flush every line [default: %default]")
    14.   (options, args) = opts.parse_args()
    15.  
    16.   if len(args) != 2:
    17.     print "Two arguments required for correct processing"
    18.     opts.print_help()
    19.     sys.exit(2)
    20.  
    21.   infile = args[0]
    22.   substr = args[1]
    23.   lines_count = 0
    24.   substr_count = 0
    25.   lines_substr_count = 0
    26.   if options.verbose and not options.flush:
    27.     msg = ""
    28.  
    29.   f = open(infile, 'r')
    30.   for line in f:
    31.     lines_count += 1
    32.     found = line.count(substr)
    33.     substr_count += found
    34.     if found > 0:
    35.       lines_substr_count += 1
    36.       if options.verbose and not options.flush:
    37.         msg += str(found) + ": " + line
    38.       elif options.verbose and options.flush:
    39.         print (str(found) + ": " + line).replace("n","")
    40.  
    41.   f.close()
    42.  
    43.   if options.verbose and not options.flush:
    44.     print msg
    45.   print "Lines read from file: ", str(lines_count)
    46.   print "Lines with substring found: ", str(lines_substr_count)
    47.   print "Total substrings detected: ", str(substr_count)
    48.  
    49.   return
    50.  
    51. if __name__ == "__main__":  main()

    Posted in Programming, Python | 4 Comments »