Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Archive for the 'Programming' Category

    Gallery2 ERROR_STORAGE_FAILURE fix

    1st October 2006

    I do not know why, but I’m getting this error from time to time in my gallery… It seems to behave like a measure of entropy :-)
    To fix it when “entropy broke loose” the first time, I did some searching and found the solution in different topics of the official gallery2 forum. The text below was prepared based on forum searches and the official gallery2 FAQ.

    If you get ERROR_STORAGE_FAILURE from your Gallery2 installation, when adding new photos or creating albums, then most probably there is a problem in a mysql database with the g2_SequenceId table.
    Read the rest of this entry »

    Share

    Posted in Programming, Web | 3 Comments »

    IE (Internet Explorer) margin doubling bug fixes

    27th September 2006

    In Internet Explorer for Windows (tested with version 6 SP2), if you write CSS code similar to this:

    1. #floatbox
    2. {
    3.   float: left;
    4.   width: 150px;
    5.   height: 150px;
    6.   margin-left: 100px;
    7. }

    and put your “floatbox” inside a container (such as DIV), you will actually see 200px of the left margin instead of the expected 100px. This problem is known as “IE margin-doubling bug”.

    In this post I collected solutions you can use to avoid this problem. The solution I’d recommend is at the end.
    Read the rest of this entry »

    Share

    Posted in Notepad, Programming, Web, XHTML/CSS | 2 Comments »

    PHP-Nuke 6.0/6.5 to Drupal 4.7.x/5.x migration (conversion)

    8th September 2006

    Post last updated: April 18, 2010.

    Now there is a Drupal 6.x module available. It is in no way related to the migrate script(s) below.

    The newest script version migrates from PHP-Nuke 6.5 to Drupal 5.x.
    Download the latest version of the migration script.

    In 2002 I set up a PHPNuke-6.0 – based portal. Eventually it died due to the lack of time investments and support from collaborators. Now, when time came to revive the project, I made a search and decided to use Drupal as a base CMS for the portal.
    In order to migrate userbase from an old portal to the new Drupal-powered one, and following the topic at drupal.org, I found a script and its modification.
    I used it to migrate only users, and made some cosmetic changes:

    • added options for custom phpnuke table prefixes
    • default user name is now = uname (login), not ‘temp_name’, as before
    • I replaced hard-coded links to ‘migrate.php’ with links to $_SERVER['PHP_SELF'], so that if you rename the script you don’t have any problems with that :)
    • now forum topics should not be promoted to the main page (changed 1 to 0 as hinted by Alexis)

    Finally, I would like to thank both Karthik Kumar for the original script and Alexis Bellido for the 6.0_to_4.7 modification.
    Read the rest of this entry »

    Share

    Posted in CMS, Drupal, how-to, PHP, Programming, Web | 77 Comments »

    Allow posting duplicate form-name entries with different values

    6th September 2006

    Sometimes, writing automatic HTML forms processors, you need to post several values with the same name of the form field, e.g.:
    collection_gene = str_chrom_name
    collection_gene = gene_stable_id

    This is against the RFC on form fields design and submitting, but this approach is used – for example, by Ensembl. I spent some time to figure out how to make HTTP_Client and HTTP_Request submit multiple ‘name-value’ pairs instead of one (the latest defined, which overrides the previous). The solution is extremely simple:
    Read the rest of this entry »

    Share

    Posted in Bioinformatics, how-to, PHP, Programming, Science | No Comments »

    Avoiding out of memory fatal error when using HTTP_Client or HTTP_Request

    6th September 2006

    If you fetch large amounts of data (e.g. over 2MB per request) using HTTP_Client (or HTTP_request), you may get “out of memory” fatal errors, especially if:

    1. memory_limit is set to default 8M, and
    2. you process multiple pages using single non-reset instance of HTTP_Client object.

    This problem can manifest itself by producing fatal error after a couple of cycles of successful page retrieval – but always, if run with the same parameters, after some constant or only slightly variable number of cycles.

    In my case the problem was that HTTP_Request (a dependancy of HTTP_Client) was holding in memory all the previously fetched pages of the current session (the ‘history’ feature). To force HTTP_Request to hold only the most recent page, you need to ‘disable’ history after creating the HTTP_Client or HTTP_Request object instance:

    1. $req = &new HTTP_Client($params, $headers);
    2. // disable history to save memory
    3. $req->enableHistory(false);

    Hope this helps you.

    Share

    Posted in Bioinformatics, how-to, PHP, Programming, Science | No Comments »

    Using PEAR HTTP_Client or HTTP_Request with HTTP proxy

    6th September 2006

    If you happen to write PHP script, which uses either HTTP_Client or its dependancy HTTP_Request from PEAR, and the script is supposed to work through the HTTP proxy – here are the sample settings you need:

    1. $params['proxy_user'] = 'proxy_username';
    2. $params['proxy_pass'] = 'proxy_password';
    3. $params['proxy_host'] = 'proxy_hostname_or_ip';
    4. $params['proxy_port'] = 8080; // 3128, ...
    5.  
    6. // I assume $headers were set somewhere else
    7. $req = &new HTTP_Client($params, $headers);

    If your proxy does not need authorization – just drop the proxy_user and proxy_pass parameters.

    Share

    Posted in how-to, PHP, Programming | 1 Comment »

    Topologilinux 6.0.0 BSOD (Blue Screen Of Death) fix

    1st September 2006

    Topologilinux ‘BSOD at launch’ problem solution is at the end of this post.

    Topologilinux is a special linux flavour, which is especially fit for the newcomers to the *nix world. The motto of Topologilunux is ‘Running Linux inside Windows’ – and that is what it does. Even more – you can run it inside windows, or you can boot into it and work Linux-only – in both cases the system is the same.
    Personally, I consider this kind of setup extremely useful for users who are strongly used to working in Windows (or just stuck with windows for too long), but at the same time are inclined to script a bit (be it bash, Perl, PHP or Python), to run server applications, write cross-platform programs, to test something or just play with software. With Topologilunux, it’s perfectly fine to work in DreamWeaver on your windows machine, and launch Topologilinux with apache+php+mysql to serve as a testing server – on that same machine. You can easily replicate the needed server config, and play with it the way you wouldn’t if that was the production server.
    Read the rest of this entry »

    Share

    Posted in *nix, OS | 1 Comment »